diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index a57d3149f444..2bf7a7f5e5e5 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -1,11 +1,11 @@ { - "commit": "8a20cee044fafde7ae0364edab45a577aa80d20f", + "commit": "daec8ebb9a97ae07a96f1efe2a8e7201beca73f2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.16", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/security/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py index 065a74405620..0bfeac5dfa1e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py index a9cabbbfa717..d57ef4c5c1fb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py @@ -77,7 +77,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'discovered_security_solutions': '2020-01-01', 'external_security_solutions': '2020-01-01', 'governance_assignments': '2022-01-01-preview', - 'governance_rule': '2022-01-01-preview', 'governance_rules': '2022-01-01-preview', 'information_protection_policies': '2017-08-01-preview', 'ingestion_settings': '2021-01-15-preview', @@ -96,9 +95,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'secure_score_control_definitions': '2020-01-01', 'secure_score_controls': '2020-01-01', 'secure_scores': '2020-01-01', - 'security_connector_governance_rule': '2022-01-01-preview', - 'security_connector_governance_rules': '2022-01-01-preview', - 'security_connector_governance_rules_execute_status': '2022-01-01-preview', 'security_contacts': '2017-08-01-preview', 'security_solutions': '2020-01-01', 'security_solutions_reference_data': '2020-01-01', @@ -108,7 +104,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'sql_vulnerability_assessment_scan_results': '2020-07-01-preview', 'sql_vulnerability_assessment_scans': '2020-07-01-preview', 'sub_assessments': '2019-01-01-preview', - 'subscription_governance_rules_execute_status': '2022-01-01-preview', 'tasks': '2015-06-01-preview', 'topology': '2020-01-01', 'workspace_settings': '2017-08-01-preview', @@ -120,10 +115,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -542,20 +537,6 @@ def governance_assignments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GovernanceRuleOperations` - """ - api_version = self._get_api_version('governance_rule') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import GovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def governance_rules(self): """Instance depends on the API version: @@ -839,48 +820,6 @@ def security_connector_applications(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def security_connector_governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRuleOperations` - """ - api_version = self._get_api_version('security_connector_governance_rule') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def security_connectors(self): """Instance depends on the API version: @@ -1047,20 +986,6 @@ def sub_assessments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def subscription_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SubscriptionGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('subscription_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from .v2022_01_01_preview.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def tasks(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py index 240df16c57f3..25467dfc00bb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore 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') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? 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__) @@ -276,47 +304,42 @@ 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): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + 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 + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + 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)`. @@ -330,8 +353,15 @@ 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: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,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. @@ -390,7 +420,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 @@ -403,16 +438,20 @@ 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 = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else 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, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "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, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,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: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,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) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in 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 @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1270,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + 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) @@ -1268,17 +1285,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?') + 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, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + 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 # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,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 @@ -1508,7 +1517,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, @@ -1518,15 +1527,14 @@ 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: return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1988,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py index 1e7bb939778c..f085bcc1fe5d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py index 88bde0dbc421..cbeead71e00f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py @@ -77,7 +77,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'discovered_security_solutions': '2020-01-01', 'external_security_solutions': '2020-01-01', 'governance_assignments': '2022-01-01-preview', - 'governance_rule': '2022-01-01-preview', 'governance_rules': '2022-01-01-preview', 'information_protection_policies': '2017-08-01-preview', 'ingestion_settings': '2021-01-15-preview', @@ -96,9 +95,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'secure_score_control_definitions': '2020-01-01', 'secure_score_controls': '2020-01-01', 'secure_scores': '2020-01-01', - 'security_connector_governance_rule': '2022-01-01-preview', - 'security_connector_governance_rules': '2022-01-01-preview', - 'security_connector_governance_rules_execute_status': '2022-01-01-preview', 'security_contacts': '2017-08-01-preview', 'security_solutions': '2020-01-01', 'security_solutions_reference_data': '2020-01-01', @@ -108,7 +104,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'sql_vulnerability_assessment_scan_results': '2020-07-01-preview', 'sql_vulnerability_assessment_scans': '2020-07-01-preview', 'sub_assessments': '2019-01-01-preview', - 'subscription_governance_rules_execute_status': '2022-01-01-preview', 'tasks': '2015-06-01-preview', 'topology': '2020-01-01', 'workspace_settings': '2017-08-01-preview', @@ -123,7 +118,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -542,20 +537,6 @@ def governance_assignments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GovernanceRuleOperations` - """ - api_version = self._get_api_version('governance_rule') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import GovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def governance_rules(self): """Instance depends on the API version: @@ -839,48 +820,6 @@ def security_connector_applications(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def security_connector_governance_rule(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRuleOperations` - """ - api_version = self._get_api_version('security_connector_governance_rule') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRuleOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def security_connector_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SecurityConnectorGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('security_connector_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def security_connectors(self): """Instance depends on the API version: @@ -1047,20 +986,6 @@ def sub_assessments(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def subscription_governance_rules_execute_status(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`SubscriptionGovernanceRulesExecuteStatusOperations` - """ - api_version = self._get_api_version('subscription_governance_rules_execute_status') - if api_version == '2022-01-01-preview': - from ..v2022_01_01_preview.aio.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def tasks(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py index c5a559682c88..9b461ff85596 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] + api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json index 251d12e3010f..74a5f9aa461b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py index ac8a0bbd061b..53ec6e758519 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import LocationsOperations, Operations, TasksOperations @@ -52,7 +52,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -82,15 +82,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py index acdf00c88a84..bce3cb945a73 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] + api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py index f2384c2be350..88c01dc39e34 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import LocationsOperations, Operations, TasksOperations @@ -52,7 +52,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py index 85fff64e04d6..8e1c2e52e196 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._tasks_operations import TasksOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py index 8192e2fba9ae..e15ffc68efa5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py @@ -73,10 +73,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] + ) + cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -113,7 +113,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AscLocationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +140,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} @distributed_trace_async async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: @@ -165,10 +165,10 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] + ) + cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -179,9 +179,9 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,4 +198,4 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py index 29ad792ed595..58597ddf56a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/operations"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py index b29058c24837..c70a4822519c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py @@ -81,10 +81,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +106,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +122,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,13 +130,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -149,7 +149,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} @distributed_trace def list_by_home_region( @@ -171,10 +171,10 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -197,7 +197,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -213,7 +213,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -221,13 +221,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -240,7 +240,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace_async async def get_subscription_level_task( @@ -269,10 +271,10 @@ async def get_subscription_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( asc_location=asc_location, @@ -284,9 +286,9 @@ async def get_subscription_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -303,7 +305,9 @@ async def get_subscription_level_task( return deserialized - get_subscription_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_subscription_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace_async async def update_subscription_level_task_state( # pylint: disable=inconsistent-return-statements @@ -340,10 +344,10 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( asc_location=asc_location, @@ -356,9 +360,9 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -371,7 +375,9 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_subscription_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } @distributed_trace def list_by_resource_group( @@ -396,10 +402,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -423,7 +429,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -439,7 +445,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -447,13 +453,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -466,7 +472,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace_async async def get_resource_group_level_task( @@ -498,10 +506,10 @@ async def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( resource_group_name=resource_group_name, @@ -514,9 +522,9 @@ async def get_resource_group_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -533,7 +541,9 @@ async def get_resource_group_level_task( return deserialized - get_resource_group_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_resource_group_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace_async async def update_resource_group_level_task_state( # pylint: disable=inconsistent-return-statements @@ -574,10 +584,10 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_task_state_request( resource_group_name=resource_group_name, @@ -591,9 +601,9 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -606,4 +616,6 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_resource_group_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py index b37bdd7f8291..66eeb1a94bdd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/__init__.py @@ -20,7 +20,7 @@ from ._security_center_enums import TaskUpdateActionType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py index 01d1fdf0e11b..d44f89cb8219 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py @@ -48,7 +48,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 @@ -84,7 +84,7 @@ class AscLocation(Resource): "properties": {"key": "properties", "type": "object"}, } - def __init__(self, *, properties: Optional[JSON] = None, **kwargs): + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword properties: An empty set of properties. :paramtype properties: JSON @@ -114,7 +114,7 @@ class AscLocationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -155,7 +155,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -186,7 +186,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 @@ -217,7 +217,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Security operation display. :paramtype display: ~azure.mgmt.security.v2015_06_01_preview.models.OperationDisplay @@ -257,7 +257,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 @@ -286,7 +286,7 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Security operations. :paramtype value: list[~azure.mgmt.security.v2015_06_01_preview.models.Operation] @@ -342,7 +342,9 @@ class SecurityTask(Resource): "sub_state": {"key": "properties.subState", "type": "str"}, } - def __init__(self, *, security_task_parameters: Optional["_models.SecurityTaskParameters"] = None, **kwargs): + def __init__( + self, *, security_task_parameters: Optional["_models.SecurityTaskParameters"] = None, **kwargs: Any + ) -> None: """ :keyword security_task_parameters: Changing set of properties, depending on the task type that is derived from the name field. @@ -378,7 +380,7 @@ class SecurityTaskList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -406,7 +408,7 @@ class SecurityTaskParameters(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py index 85fff64e04d6..8e1c2e52e196 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._tasks_operations import TasksOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py index a6ae0bc51282..9d9391357360 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,10 +134,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] + ) + cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -158,7 +158,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -174,7 +174,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -182,13 +182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AscLocationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -201,7 +201,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations"} @distributed_trace def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: @@ -226,10 +226,10 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] + ) + cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -240,9 +240,9 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -259,4 +259,4 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py index 49b52920f5cf..1a99a755c7b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py @@ -45,9 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +93,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +132,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +140,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -159,4 +159,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/operations"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py index bd53fab9ae24..68b2b57bcb57 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_list_by_home_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_list_by_home_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,9 +112,9 @@ def build_get_subscription_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_subscription_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,9 +151,9 @@ def build_update_subscription_level_task_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +170,7 @@ def build_update_subscription_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,9 +187,9 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_list_by_resource_group_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_get_resource_group_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +247,7 @@ def build_get_resource_group_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,9 +269,9 @@ def build_update_resource_group_level_task_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_resource_group_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -336,10 +336,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -361,7 +361,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -377,7 +377,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -385,13 +385,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -404,7 +404,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks"} @distributed_trace def list_by_home_region( @@ -426,10 +426,10 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -452,7 +452,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -468,7 +468,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -476,13 +476,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -495,7 +495,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace def get_subscription_level_task(self, asc_location: str, task_name: str, **kwargs: Any) -> _models.SecurityTask: @@ -522,10 +524,10 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( asc_location=asc_location, @@ -537,9 +539,9 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -556,7 +558,9 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg return deserialized - get_subscription_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_subscription_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace def update_subscription_level_task_state( # pylint: disable=inconsistent-return-statements @@ -593,10 +597,10 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( asc_location=asc_location, @@ -609,9 +613,9 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -624,7 +628,9 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - update_subscription_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_subscription_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } @distributed_trace def list_by_resource_group( @@ -649,10 +655,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] + ) + cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -676,7 +682,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -692,7 +698,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -700,13 +706,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityTaskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -719,7 +725,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks" + } @distributed_trace def get_resource_group_level_task( @@ -751,10 +759,10 @@ def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] + ) + cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( resource_group_name=resource_group_name, @@ -767,9 +775,9 @@ def get_resource_group_level_task( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -786,7 +794,9 @@ def get_resource_group_level_task( return deserialized - get_resource_group_level_task.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"} # type: ignore + get_resource_group_level_task.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" + } @distributed_trace def update_resource_group_level_task_state( # pylint: disable=inconsistent-return-statements @@ -827,10 +837,10 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2015-06-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2015-06-01-preview") - ) # type: Literal["2015-06-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_task_state_request( resource_group_name=resource_group_name, @@ -844,9 +854,9 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -859,4 +869,6 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_task_state.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}"} # type: ignore + update_resource_group_level_task_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py index 7c2f0329f3c1..9bf93a6f2872 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", "2017-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json index a3d9e73ca6f8..4e5c275338ef 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py index 018a0d49e1c4..2b5b5e334495 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ComplianceResultsOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -73,15 +73,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py index a9eb28389fa5..df97c25cd544 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", "2017-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py index 2f640b6ea119..a7d387df1246 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ComplianceResultsOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py index 05cc3fb3f4a0..7cfcb2ac627d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._compliance_results_operations import ComplianceResultsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py index 0c69edc315df..9932b6aded1c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py @@ -75,8 +75,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.ComplianceRe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -97,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -113,7 +113,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +121,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceResultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,7 +140,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} @distributed_trace_async async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _models.ComplianceResult: @@ -166,8 +166,8 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -178,9 +178,9 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +197,4 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py index 6cae848e2e56..1303df6fb8f4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import ResourceStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py index 83794a205d77..8c1f38087f62 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List +from typing import Any, List, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class CloudErrorBody(_serialization.Model): """The error detail. @@ -45,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +84,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 @@ -118,7 +122,7 @@ class ComplianceResult(Resource): "resource_status": {"key": "properties.resourceStatus", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_status = None @@ -147,7 +151,7 @@ class ComplianceResultList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ComplianceResult"], **kwargs): + def __init__(self, *, value: List["_models.ComplianceResult"], **kwargs: Any) -> None: """ :keyword value: List of compliance results. Required. :paramtype value: list[~azure.mgmt.security.v2017_08_01.models.ComplianceResult] @@ -178,7 +182,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py index 18ebcfc26cc5..06b060062754 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/models/_security_center_enums.py @@ -13,11 +13,11 @@ class ResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the resource regarding a single assessment.""" - #: This assessment on the resource is healthy HEALTHY = "Healthy" - #: This assessment is not applicable to this resource + """This assessment on the resource is healthy""" NOT_APPLICABLE = "NotApplicable" - #: This assessment is turned off by policy on this subscription + """This assessment is not applicable to this resource""" OFF_BY_POLICY = "OffByPolicy" - #: This assessment on the resource is not healthy + """This assessment is turned off by policy on this subscription""" NOT_HEALTHY = "NotHealthy" + """This assessment on the resource is not healthy""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py index 05cc3fb3f4a0..7cfcb2ac627d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._compliance_results_operations import ComplianceResultsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py index b62b7604b5c2..2b0aa1bd0821 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A "complianceResultName": _SERIALIZER.url("compliance_result_name", compliance_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,8 +127,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.ComplianceResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -149,7 +149,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -165,7 +165,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -173,13 +173,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceResultList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,7 +192,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/complianceResults"} @distributed_trace def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _models.ComplianceResult: @@ -218,8 +218,8 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] + api_version: Literal["2017-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -230,9 +230,9 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -249,4 +249,4 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py index 93d7fbe4adcb..46fd8eba8b0e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] + api_version: Literal["2017-08-01-preview"] = kwargs.pop("api_version", "2017-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json index b1b962d4083c..5e7fa8c664a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py index d08c19685330..62f7262ee1cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -66,7 +66,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -106,15 +106,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py index 00d25b5afc26..e6b9dee820a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] + api_version: Literal["2017-08-01-preview"] = kwargs.pop("api_version", "2017-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py index 65faa86f575d..34c0b101f5da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py index 44edabecfaab..a09258020a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._workspace_settings_operations import WorkspaceSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py index 3550d9f4a2b4..31cebb493817 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py @@ -76,10 +76,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutoProvisioningSetting" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] + ) + cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutoProvisioningSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} @distributed_trace_async async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetting: @@ -167,10 +167,10 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -181,9 +181,9 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +200,9 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } @overload async def create( @@ -274,11 +276,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -300,9 +302,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,4 +321,6 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py index 461dcaad1f17..69bf49d94075 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py @@ -75,10 +75,10 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Compliance"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] + ) + cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -99,7 +99,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -115,7 +115,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,13 +123,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +142,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} @distributed_trace_async async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compliance: @@ -170,10 +170,10 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] + ) + cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -184,9 +184,9 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,4 +203,4 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py index 089089b739d3..efbb552c87c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py @@ -95,10 +95,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -109,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +128,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @overload async def create_or_update( @@ -234,11 +236,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -260,9 +262,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,11 +281,13 @@ async def create_or_update( deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.InformationProtectionPolicy"]: @@ -303,10 +307,10 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.InformationP _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] + ) + cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -327,7 +331,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -343,7 +347,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -351,13 +355,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InformationProtectionPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -370,4 +374,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py index 3c4645fac8a9..a86822af1e52 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py @@ -77,10 +77,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] + ) + cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityContactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,7 +144,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} @distributed_trace_async async def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityContact: @@ -168,10 +168,10 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( security_contact_name=security_contact_name, @@ -182,9 +182,9 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,7 +201,9 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload async def create( @@ -276,11 +278,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -302,9 +304,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +323,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -347,10 +351,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( security_contact_name=security_contact_name, @@ -361,9 +365,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,7 +380,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload async def update( @@ -451,11 +457,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -477,9 +483,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -496,4 +502,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py index 3aadca5bb094..35b568134f29 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py @@ -78,10 +78,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] + ) + cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} @distributed_trace_async async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSetting: @@ -170,10 +170,10 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( workspace_setting_name=workspace_setting_name, @@ -184,9 +184,9 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,9 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload async def create( @@ -283,11 +285,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -309,9 +311,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +330,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload async def update( @@ -408,11 +412,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -434,9 +438,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -453,7 +457,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -480,10 +486,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( workspace_setting_name=workspace_setting_name, @@ -494,9 +500,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -509,4 +515,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py index 244166e9bdfb..d832d981d78d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/__init__.py @@ -30,7 +30,7 @@ from ._security_center_enums import InformationProtectionPolicyName from ._security_center_enums import Rank from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py index ddc32bace03c..a091483957fc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -41,7 +41,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 @@ -78,7 +78,7 @@ class AutoProvisioningSetting(Resource): "auto_provision": {"key": "properties.autoProvision", "type": "str"}, } - def __init__(self, *, auto_provision: Optional[Union[str, "_models.AutoProvision"]] = None, **kwargs): + def __init__(self, *, auto_provision: Optional[Union[str, "_models.AutoProvision"]] = None, **kwargs: Any) -> None: """ :keyword auto_provision: Describes what kind of security agent provisioning action to take. Known values are: "On" and "Off". @@ -108,7 +108,7 @@ class AutoProvisioningSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.AutoProvisioningSetting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AutoProvisioningSetting"]] = None, **kwargs: Any) -> None: """ :keyword value: List of all the auto provisioning settings. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.AutoProvisioningSetting] @@ -152,7 +152,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -202,7 +202,7 @@ class Compliance(Resource): "assessment_result": {"key": "properties.assessmentResult", "type": "[ComplianceSegment]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.assessment_timestamp_utc_date = None @@ -230,7 +230,7 @@ class ComplianceList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Compliance"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Compliance"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Compliance objects. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.Compliance] @@ -262,7 +262,7 @@ class ComplianceSegment(_serialization.Model): "percentage": {"key": "percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.segment_type = None @@ -290,7 +290,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 @@ -324,8 +324,8 @@ def __init__( custom: Optional[bool] = None, can_be_numeric: Optional[bool] = None, excluded: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pattern: The keyword pattern. :paramtype pattern: str @@ -388,8 +388,8 @@ def __init__( *, labels: Optional[Dict[str, "_models.SensitivityLabel"]] = None, information_types: Optional[Dict[str, "_models.InformationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword labels: Dictionary of sensitivity labels. :paramtype labels: dict[str, ~azure.mgmt.security.v2017_08_01_preview.models.SensitivityLabel] @@ -425,7 +425,7 @@ class InformationProtectionPolicyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.InformationProtectionPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.InformationProtectionPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: List of information protection policies. :paramtype value: @@ -477,8 +477,8 @@ def __init__( enabled: Optional[bool] = None, custom: Optional[bool] = None, keywords: Optional[List["_models.InformationProtectionKeyword"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the information type. :paramtype display_name: str @@ -555,8 +555,8 @@ def __init__( phone: Optional[str] = None, alert_notifications: Optional[Union[str, "_models.AlertNotifications"]] = None, alerts_to_admins: Optional[Union[str, "_models.AlertsToAdmins"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword email: The email of this security contact. :paramtype email: str @@ -599,7 +599,7 @@ class SecurityContactList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -638,8 +638,8 @@ def __init__( rank: Optional[Union[str, "_models.Rank"]] = None, order: Optional[int] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the sensitivity label. :paramtype display_name: str @@ -693,7 +693,7 @@ class WorkspaceSetting(Resource): "scope": {"key": "properties.scope", "type": "str"}, } - def __init__(self, *, workspace_id: Optional[str] = None, scope: Optional[str] = None, **kwargs): + def __init__(self, *, workspace_id: Optional[str] = None, scope: Optional[str] = None, **kwargs: Any) -> None: """ :keyword workspace_id: The full Azure ID of the workspace to save the data in. :paramtype workspace_id: str @@ -729,7 +729,7 @@ class WorkspaceSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.WorkspaceSetting"], **kwargs): + def __init__(self, *, value: List["_models.WorkspaceSetting"], **kwargs: Any) -> None: """ :keyword value: List of workspace settings. Required. :paramtype value: list[~azure.mgmt.security.v2017_08_01_preview.models.WorkspaceSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py index f0bd20d296e4..2250b56a7e1f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/models/_security_center_enums.py @@ -13,28 +13,28 @@ class AlertNotifications(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to send security alerts notifications to the security contact.""" - #: Get notifications on new alerts ON = "On" - #: Don't get notifications on new alerts + """Get notifications on new alerts""" OFF = "Off" + """Don't get notifications on new alerts""" class AlertsToAdmins(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to send security alerts notifications to subscription admins.""" - #: Send notification on new alerts to the subscription's admins ON = "On" - #: Don't send notification on new alerts to the subscription's admins + """Send notification on new alerts to the subscription's admins""" OFF = "Off" + """Don't send notification on new alerts to the subscription's admins""" class AutoProvision(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes what kind of security agent provisioning action to take.""" - #: Install missing security agent on VMs automatically ON = "On" - #: Do not install security agent on the VMs automatically + """Install missing security agent on VMs automatically""" OFF = "Off" + """Do not install security agent on the VMs automatically""" class InformationProtectionPolicyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py index 44edabecfaab..a09258020a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/__init__.py @@ -13,7 +13,7 @@ from ._workspace_settings_operations import WorkspaceSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py index c4caaaa8c4ca..6a60cb8a86fa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,9 +75,9 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,10 +107,10 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutoProvisioningSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] + ) + cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -195,7 +195,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -211,7 +211,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -219,13 +219,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutoProvisioningSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -238,7 +238,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings"} @distributed_trace def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetting: @@ -262,10 +262,10 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -276,9 +276,9 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -295,7 +295,9 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } @overload def create( @@ -369,11 +371,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -395,9 +397,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,4 +416,6 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py index d29f85ec3a43..2eaed77478d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py @@ -45,9 +45,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe "complianceName": _SERIALIZER.url("compliance_name", compliance_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,10 +130,10 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.Compliance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] + ) + cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -154,7 +154,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -170,7 +170,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +178,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ComplianceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,7 +197,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances"} @distributed_trace def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compliance: @@ -225,10 +225,10 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] + ) + cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -239,9 +239,9 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -258,4 +258,4 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/compliances/{complianceName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py index 63720c65bf74..bf13b0781fea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,10 +81,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,9 +116,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,10 +190,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -204,9 +204,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -223,7 +223,9 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @overload def create_or_update( @@ -329,11 +331,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +357,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,11 +376,13 @@ def create_or_update( deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + } @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.InformationProtectionPolicy"]: @@ -398,10 +402,10 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.InformationProtec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] + ) + cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -422,7 +426,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -438,7 +442,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -446,13 +450,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InformationProtectionPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -465,4 +469,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/informationProtectionPolicies"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py index 26de75d54020..95e93805eca8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,9 +140,9 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,10 +172,10 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,10 +235,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] + ) + cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -259,7 +259,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -275,7 +275,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -283,13 +283,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityContactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -302,7 +302,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts"} @distributed_trace def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityContact: @@ -326,10 +326,10 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( security_contact_name=security_contact_name, @@ -340,9 +340,9 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -359,7 +359,9 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload def create( @@ -434,11 +436,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -460,9 +462,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +481,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -505,10 +509,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( security_contact_name=security_contact_name, @@ -519,9 +523,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -534,7 +538,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } @overload def update( @@ -609,11 +615,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -635,9 +641,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -654,4 +660,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py index e246cf1e71b5..56cc517724af 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,10 +140,10 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,9 +175,9 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,10 +236,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] + ) + cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -260,7 +260,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -276,7 +276,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -284,13 +284,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -303,7 +303,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings"} @distributed_trace def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSetting: @@ -328,10 +328,10 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( workspace_setting_name=workspace_setting_name, @@ -342,9 +342,9 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,9 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload def create( @@ -441,11 +443,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -467,9 +469,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -486,7 +488,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @overload def update( @@ -566,11 +570,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -592,9 +596,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -611,7 +615,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -638,10 +644,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2017-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2017-08-01-preview") - ) # type: Literal["2017-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( workspace_setting_name=workspace_setting_name, @@ -652,9 +658,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -667,4 +673,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py index 1a9383b9ca50..51e623ca6fe7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", "2018-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json index a257924c29e6..2f8418e09f10 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py index e0d6757c1d68..2d98b587d98f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py index 71ecbf233ba3..00ef4f7e6b54 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", "2018-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py index 86c43ee8c1f2..10b1d0f340d5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py index 16cf1bb363a4..7c7c8f4cda78 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -86,9 +86,9 @@ async def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace_async async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -129,8 +129,8 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -141,9 +141,9 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -160,7 +160,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload async def update( @@ -227,9 +227,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -251,9 +251,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +270,4 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py index a6335e2b1d2d..82e99d49aec6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import PricingTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py index 862abf08fbe4..0b221dd84f01 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +80,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 @@ -112,7 +112,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 @@ -121,7 +121,9 @@ def __init__(self, **kwargs): class Pricing(Resource): - """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. + """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the + standard tier available with a trial period. The standard tier offers advanced security + capabilities, while the free tier offers basic security features. Variables are only populated by the server, and will be ignored when sending a request. @@ -156,7 +158,7 @@ class Pricing(Resource): "free_trial_remaining_time": {"key": "properties.freeTrialRemainingTime", "type": "duration"}, } - def __init__(self, *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, **kwargs): + def __init__(self, *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, **kwargs: Any) -> None: """ :keyword pricing_tier: The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The @@ -186,7 +188,7 @@ class PricingList(_serialization.Model): "value": {"key": "value", "type": "[Pricing]"}, } - def __init__(self, *, value: List["_models.Pricing"], **kwargs): + def __init__(self, *, value: List["_models.Pricing"], **kwargs: Any) -> None: """ :keyword value: List of pricing configurations. Required. :paramtype value: list[~azure.mgmt.security.v2018_06_01.models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py index 3a3bb1f34505..340d6e87274f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/models/_security_center_enums.py @@ -16,7 +16,7 @@ class PricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): advanced security capabilities, while the free tier offers basic security features. """ - #: Get free Microsoft Defender for Cloud experience with basic security features FREE = "Free" - #: Get the standard Microsoft Defender for Cloud experience with advanced security features + """Get free Microsoft Defender for Cloud experience with basic security features""" STANDARD = "Standard" + """Get the standard Microsoft Defender for Cloud experience with advanced security features""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py index f45646b09a91..8687eb48393e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +165,8 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -176,9 +176,9 @@ def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +195,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -219,8 +219,8 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -231,9 +231,9 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +250,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload def update( @@ -317,9 +317,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,9 +341,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,4 +360,4 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py index e06429a27991..045475e6f425 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", "2019-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json index 5b738d4c8656..650d1efaf70d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py index ccfc826e7e45..c85238515781 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AdvancedThreatProtectionOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -73,15 +73,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py index 5d8fbb0d22b9..6bb593062b3f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", "2019-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py index 17f3bffc91f0..fd6c736b0367 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AdvancedThreatProtectionOperations @@ -43,7 +43,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py index 6da7520b4298..950166c69a9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py index 28684d54f261..a48860465c9e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py @@ -80,9 +80,9 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -93,9 +93,9 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +112,7 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} @overload async def create( @@ -206,10 +206,10 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,9 +231,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,4 +250,6 @@ async def create( return deserialized - create.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py index d04090e27218..8c7246cc6182 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/__init__.py @@ -11,7 +11,7 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py index 32dcb0acd2ac..f6957b29d889 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional +from typing import Any, Optional from ... import _serialization @@ -37,7 +37,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 @@ -73,7 +73,7 @@ class AdvancedThreatProtectionSetting(Resource): "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, } - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_enabled: Indicates whether Advanced Threat Protection is enabled. :paramtype is_enabled: bool @@ -115,7 +115,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -146,7 +146,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py index 6da7520b4298..950166c69a9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py index 28b043a74cbb..b807101ec732 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py @@ -43,8 +43,8 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +142,9 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -155,9 +155,9 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -174,7 +174,7 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} @overload def create( @@ -268,10 +268,10 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] - setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] + api_version: Literal["2019-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + setting_name: Literal["current"] = kwargs.pop("setting_name", "current") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -293,9 +293,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -312,4 +312,6 @@ def create( return deserialized - create.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}"} # type: ignore + create.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py index e0525d39cb17..e9a2fdedb7a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] + api_version: Literal["2019-01-01-preview"] = kwargs.pop("api_version", "2019-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json index 65712a8b6388..d5413f04762c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py index a5196bde8981..910de1cd3c95 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -70,7 +70,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -111,15 +111,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py index 6cd221fea7b4..e2e92c2aa6a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] + api_version: Literal["2019-01-01-preview"] = kwargs.pop("api_version", "2019-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py index 5e6f806c4263..c2d81d41de54 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -71,7 +71,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py index aeb88535eb28..e25e3fcfcdf1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/__init__.py @@ -14,7 +14,7 @@ from ._alerts_suppression_rules_operations import AlertsSuppressionRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py index eeb3135f3277..f04e3164e334 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py @@ -79,10 +79,10 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] + ) + cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +104,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +120,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +128,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertsSuppressionRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,7 +147,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} @distributed_trace_async async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.AlertsSuppressionRule: @@ -171,10 +171,10 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -185,9 +185,9 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,9 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @overload async def update( @@ -289,11 +291,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -315,9 +317,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -334,7 +336,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -360,10 +364,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -374,9 +378,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +393,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py index 6947366b1082..b7540963abc6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Automation"]: @@ -165,10 +165,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -233,7 +233,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations" + } @distributed_trace_async async def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _models.Automation: @@ -260,10 +262,10 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -275,9 +277,9 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -294,7 +296,9 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload async def create_or_update( @@ -388,11 +392,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,9 +419,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -434,11 +438,13 @@ async def create_or_update( deserialized = self._deserialize("Automation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -467,10 +473,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -482,9 +488,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -497,7 +503,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload async def validate( @@ -591,11 +599,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -618,9 +626,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -637,4 +645,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py index 0da66fe3d056..c1cfd144eeb2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py @@ -86,10 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] + ) + cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,13 +137,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -156,7 +156,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments" + } @distributed_trace_async async def get( @@ -193,10 +195,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] + ) + cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -209,9 +211,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -228,4 +230,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py index c33dad3da474..24d41d68eaf8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py @@ -79,10 +79,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] + ) + cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +121,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,7 +148,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls" + } @distributed_trace_async async def get( @@ -178,10 +180,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] + ) + cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -193,9 +195,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,4 +214,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py index a1a59794d533..7e008acf9f61 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py @@ -76,10 +76,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] + ) + cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +101,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +117,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +125,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceStandardList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + } @distributed_trace_async async def get( @@ -171,10 +173,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] + ) + cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -185,9 +187,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,4 +206,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py index 3522593c3c28..024190bec6fb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py @@ -76,10 +76,10 @@ def list_all(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} # type: ignore + list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable["_models.SecuritySubAssessment"]: @@ -165,10 +165,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -233,7 +233,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} @distributed_trace_async async def get( @@ -266,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] + ) + cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -281,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -300,4 +300,6 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py index 09a25196df77..93bc6625aac2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/__init__.py @@ -61,7 +61,7 @@ from ._security_center_enums import State from ._security_center_enums import SubAssessmentStatusCode from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py index 2c43420efd06..2aec4b3ea73f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_models_py3.py @@ -48,10 +48,10 @@ class AdditionalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = None # type: Optional[str] + self.assessed_resource_type: Optional[str] = None class Resource(_serialization.Model): @@ -79,7 +79,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 @@ -146,8 +146,8 @@ def __init__( state: Optional[Union[str, "_models.RuleState"]] = None, comment: Optional[str] = None, suppression_alerts_scope: Optional["_models.SuppressionAlertsScope"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_type: Type of the alert to automatically suppress. For all alert types, use '*'. :paramtype alert_type: str @@ -198,7 +198,7 @@ class AlertsSuppressionRulesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.AlertsSuppressionRule"], **kwargs): + def __init__(self, *, value: List["_models.AlertsSuppressionRule"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: list[~azure.mgmt.security.v2019_01_01_preview.models.AlertsSuppressionRule] @@ -219,7 +219,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -240,7 +240,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -261,7 +261,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -281,7 +281,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -335,8 +335,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -427,8 +427,8 @@ def __init__( scopes: Optional[List["_models.AutomationScope"]] = None, sources: Optional[List["_models.AutomationSource"]] = None, actions: Optional[List["_models.AutomationAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -491,14 +491,15 @@ class AutomationAction(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.action_type = None # type: Optional[str] + self.action_type: Optional[str] = None class AutomationActionEventHub(AutomationAction): - """The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. + """The target Event Hub to which event data will be exported. To learn more about Microsoft + Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. Variables are only populated by the server, and will be ignored when sending a request. @@ -529,8 +530,8 @@ class AutomationActionEventHub(AutomationAction): } def __init__( - self, *, event_hub_resource_id: Optional[str] = None, connection_string: Optional[str] = None, **kwargs - ): + self, *, event_hub_resource_id: Optional[str] = None, connection_string: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword event_hub_resource_id: The target Event Hub Azure Resource ID. :paramtype event_hub_resource_id: str @@ -539,14 +540,15 @@ def __init__( :paramtype connection_string: str """ super().__init__(**kwargs) - self.action_type = "EventHub" # type: str + self.action_type: str = "EventHub" self.event_hub_resource_id = event_hub_resource_id self.sas_policy_name = None self.connection_string = connection_string class AutomationActionLogicApp(AutomationAction): - """The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. + """The logic app action that should be triggered. To learn more about Microsoft Defender for + Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. All required parameters must be populated in order to send to Azure. @@ -570,7 +572,9 @@ class AutomationActionLogicApp(AutomationAction): "uri": {"key": "uri", "type": "str"}, } - def __init__(self, *, logic_app_resource_id: Optional[str] = None, uri: Optional[str] = None, **kwargs): + def __init__( + self, *, logic_app_resource_id: Optional[str] = None, uri: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword logic_app_resource_id: The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App. @@ -579,13 +583,18 @@ def __init__(self, *, logic_app_resource_id: Optional[str] = None, uri: Optional :paramtype uri: str """ super().__init__(**kwargs) - self.action_type = "LogicApp" # type: str + self.action_type: str = "LogicApp" self.logic_app_resource_id = logic_app_resource_id self.uri = uri class AutomationActionWorkspace(AutomationAction): - """The Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. + """The Log Analytics Workspace to which event data will be exported. Security alerts data will + reside in the 'SecurityAlert' table and the assessments data will reside in the + 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that + in order to view the data in the workspace, the Security Center Log Analytics free/standard + solution needs to be enabled on that workspace. To learn more about Microsoft Defender for + Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. All required parameters must be populated in order to send to Azure. @@ -605,13 +614,13 @@ class AutomationActionWorkspace(AutomationAction): "workspace_resource_id": {"key": "workspaceResourceId", "type": "str"}, } - def __init__(self, *, workspace_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, workspace_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword workspace_resource_id: The fully qualified Log Analytics Workspace Azure Resource ID. :paramtype workspace_resource_id: str """ super().__init__(**kwargs) - self.action_type = "Workspace" # type: str + self.action_type: str = "Workspace" self.workspace_resource_id = workspace_resource_id @@ -638,7 +647,7 @@ class AutomationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Automation"], **kwargs): + def __init__(self, *, value: List["_models.Automation"], **kwargs: Any) -> None: """ :keyword value: The list of security automations under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2019_01_01_preview.models.Automation] @@ -649,7 +658,8 @@ def __init__(self, *, value: List["_models.Automation"], **kwargs): class AutomationRuleSet(_serialization.Model): - """A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. + """A rule set which evaluates all its rules upon an event interception. Only when all the included + rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. :ivar rules: :vartype rules: list[~azure.mgmt.security.v2019_01_01_preview.models.AutomationTriggeringRule] @@ -659,7 +669,7 @@ class AutomationRuleSet(_serialization.Model): "rules": {"key": "rules", "type": "[AutomationTriggeringRule]"}, } - def __init__(self, *, rules: Optional[List["_models.AutomationTriggeringRule"]] = None, **kwargs): + def __init__(self, *, rules: Optional[List["_models.AutomationTriggeringRule"]] = None, **kwargs: Any) -> None: """ :keyword rules: :paramtype rules: @@ -684,7 +694,7 @@ class AutomationScope(_serialization.Model): "scope_path": {"key": "scopePath", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, scope_path: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, scope_path: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: The resources scope description. :paramtype description: str @@ -698,7 +708,9 @@ def __init__(self, *, description: Optional[str] = None, scope_path: Optional[st class AutomationSource(_serialization.Model): - """The source event types which evaluate the security automation set of rules. For example - security alerts and security assessments. To learn more about the supported security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. + """The source event types which evaluate the security automation set of rules. For example - + security alerts and security assessments. To learn more about the supported security events + data models schemas - please visit https://aka.ms/ASCAutomationSchemas. :ivar event_source: A valid event source type. Known values are: "Assessments", "AssessmentsSnapshot", "SubAssessments", "SubAssessmentsSnapshot", "Alerts", "SecureScores", @@ -720,8 +732,8 @@ def __init__( *, event_source: Optional[Union[str, "_models.EventSource"]] = None, rule_sets: Optional[List["_models.AutomationRuleSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_source: A valid event source type. Known values are: "Assessments", "AssessmentsSnapshot", "SubAssessments", "SubAssessmentsSnapshot", "Alerts", "SecureScores", @@ -738,7 +750,9 @@ def __init__( class AutomationTriggeringRule(_serialization.Model): - """A rule which is evaluated upon event interception. The rule is configured by comparing a specific value from the event model to an expected value. This comparison is done by using one of the supported operators set. + """A rule which is evaluated upon event interception. The rule is configured by comparing a + specific value from the event model to an expected value. This comparison is done by using one + of the supported operators set. :ivar property_j_path: The JPath of the entity model property that should be checked. :vartype property_j_path: str @@ -768,8 +782,8 @@ def __init__( property_type: Optional[Union[str, "_models.PropertyType"]] = None, expected_value: Optional[str] = None, operator: Optional[Union[str, "_models.Operator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property_j_path: The JPath of the entity model property that should be checked. :paramtype property_j_path: str @@ -806,7 +820,7 @@ class AutomationValidationStatus(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword is_valid: Indicates whether the model is valid or not. :paramtype is_valid: bool @@ -841,10 +855,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -871,10 +885,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -912,7 +926,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -977,10 +991,10 @@ class ContainerRegistryVulnerabilityProperties(AdditionalData): "image_digest": {"key": "imageDigest", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "ContainerRegistryVulnerability" # type: str + self.assessed_resource_type: str = "ContainerRegistryVulnerability" self.type = None self.cvss = None self.patchable = None @@ -1012,7 +1026,7 @@ class CVE(_serialization.Model): "link": {"key": "link", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.title = None @@ -1036,7 +1050,7 @@ class CVSS(_serialization.Model): "base": {"key": "base", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.base = None @@ -1063,7 +1077,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 @@ -1109,7 +1123,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -1121,7 +1137,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -1179,8 +1195,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -1202,7 +1218,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -1266,7 +1282,7 @@ class RegulatoryComplianceAssessment(Resource): # pylint: disable=too-many-inst "unsupported_resources": {"key": "properties.unsupportedResources", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the assessment's scanned resources states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1307,7 +1323,7 @@ class RegulatoryComplianceAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceAssessment"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceAssessment"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: @@ -1366,7 +1382,7 @@ class RegulatoryComplianceControl(Resource): "skipped_assessments": {"key": "properties.skippedAssessments", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the control's supported assessments states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1404,7 +1420,7 @@ class RegulatoryComplianceControlList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceControl"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceControl"], **kwargs: Any) -> None: """ :keyword value: List of regulatory compliance controls. Required. :paramtype value: @@ -1464,7 +1480,7 @@ class RegulatoryComplianceStandard(Resource): "unsupported_controls": {"key": "properties.unsupportedControls", "type": "int"}, } - def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs): + def __init__(self, *, state: Optional[Union[str, "_models.State"]] = None, **kwargs: Any) -> None: """ :keyword state: Aggregative state based on the standard's supported controls states. Known values are: "Passed", "Failed", "Skipped", and "Unsupported". @@ -1502,7 +1518,7 @@ class RegulatoryComplianceStandardList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RegulatoryComplianceStandard"], **kwargs): + def __init__(self, *, value: List["_models.RegulatoryComplianceStandard"], **kwargs: Any) -> None: """ :keyword value: Required. :paramtype value: @@ -1529,8 +1545,8 @@ class ScopeElement(_serialization.Model): } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, field: Optional[str] = None, **kwargs - ): + self, *, additional_properties: Optional[Dict[str, Any]] = None, field: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1611,8 +1627,8 @@ def __init__( status: Optional["_models.SubAssessmentStatus"] = None, resource_details: Optional["_models.ResourceDetails"] = None, additional_data: Optional["_models.AdditionalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Status of the sub-assessment. :paramtype status: ~azure.mgmt.security.v2019_01_01_preview.models.SubAssessmentStatus @@ -1655,7 +1671,7 @@ class SecuritySubAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1713,10 +1729,10 @@ class ServerVulnerabilityProperties(AdditionalData): "vendor_references": {"key": "vendorReferences", "type": "[VendorReference]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "ServerVulnerabilityAssessment" # type: str + self.assessed_resource_type: str = "ServerVulnerabilityAssessment" self.type = None self.cvss = None self.patchable = None @@ -1755,10 +1771,10 @@ class SqlServerVulnerabilityProperties(AdditionalData): "query": {"key": "query", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.assessed_resource_type = "SqlServerVulnerability" # type: str + self.assessed_resource_type: str = "SqlServerVulnerability" self.type = None self.query = None @@ -1794,7 +1810,7 @@ class SubAssessmentStatus(_serialization.Model): "severity": {"key": "severity", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1821,7 +1837,7 @@ class SuppressionAlertsScope(_serialization.Model): "all_of": {"key": "allOf", "type": "[ScopeElement]"}, } - def __init__(self, *, all_of: List["_models.ScopeElement"], **kwargs): + def __init__(self, *, all_of: List["_models.ScopeElement"], **kwargs: Any) -> None: """ :keyword all_of: All the conditions inside need to be true in order to suppress the alert. Required. @@ -1852,7 +1868,7 @@ class VendorReference(_serialization.Model): "link": {"key": "link", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.title = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py index c3e4411eb8a6..4eb15a289fb5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/models/_security_center_enums.py @@ -47,24 +47,24 @@ class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): PropertyType. """ - #: Applies for decimal and non-decimal operands EQUALS = "Equals" - #: Applies only for decimal operands + """Applies for decimal and non-decimal operands""" GREATER_THAN = "GreaterThan" - #: Applies only for decimal operands + """Applies only for decimal operands""" GREATER_THAN_OR_EQUAL_TO = "GreaterThanOrEqualTo" - #: Applies only for decimal operands + """Applies only for decimal operands""" LESSER_THAN = "LesserThan" - #: Applies only for decimal operands + """Applies only for decimal operands""" LESSER_THAN_OR_EQUAL_TO = "LesserThanOrEqualTo" - #: Applies for decimal and non-decimal operands + """Applies only for decimal operands""" NOT_EQUALS = "NotEquals" - #: Applies only for non-decimal operands + """Applies for decimal and non-decimal operands""" CONTAINS = "Contains" - #: Applies only for non-decimal operands + """Applies only for non-decimal operands""" STARTS_WITH = "StartsWith" - #: Applies only for non-decimal operands + """Applies only for non-decimal operands""" ENDS_WITH = "EndsWith" + """Applies only for non-decimal operands""" class PropertyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -97,34 +97,34 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Aggregative state based on the standard's supported controls states.""" - #: All supported regulatory compliance controls in the given standard have a passed state PASSED = "Passed" - #: At least one supported regulatory compliance control in the given standard has a state of - #: failed + """All supported regulatory compliance controls in the given standard have a passed state""" FAILED = "Failed" - #: All supported regulatory compliance controls in the given standard have a state of skipped + """At least one supported regulatory compliance control in the given standard has a state of + #: failed""" SKIPPED = "Skipped" - #: No supported regulatory compliance data for the given standard + """All supported regulatory compliance controls in the given standard have a state of skipped""" UNSUPPORTED = "Unsupported" + """No supported regulatory compliance data for the given standard""" class SubAssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py index aeb88535eb28..e25e3fcfcdf1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/__init__.py @@ -14,7 +14,7 @@ from ._alerts_suppression_rules_operations import AlertsSuppressionRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py index 276f7999f3a4..592f615f31a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,10 +111,10 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,9 +148,9 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,10 +213,10 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] + ) + cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -238,7 +238,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -254,7 +254,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -262,13 +262,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertsSuppressionRulesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -281,7 +281,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules"} @distributed_trace def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.AlertsSuppressionRule: @@ -305,10 +305,10 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -319,9 +319,9 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -338,7 +338,9 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @overload def update( @@ -423,11 +425,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -449,9 +451,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -468,7 +470,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -494,10 +498,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( alerts_suppression_rule_name=alerts_suppression_rule_name, @@ -508,9 +512,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -523,4 +527,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py index 0a0b26b9ab24..15d27ba75262 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,9 +186,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +206,7 @@ def build_delete_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -223,10 +223,10 @@ def build_validate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +244,7 @@ def build_validate_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Automation"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] + ) + cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AutomationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations" + } @distributed_trace def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _models.Automation: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload def create_or_update( @@ -599,11 +603,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -626,9 +630,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -645,11 +649,13 @@ def create_or_update( deserialized = self._deserialize("Automation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -678,10 +684,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -693,9 +699,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -708,7 +714,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" + } @overload def validate( @@ -802,11 +810,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -829,9 +837,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -848,4 +856,6 @@ def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py index 60392fa32a0e..9e043552b7e7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py @@ -52,9 +52,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,9 +97,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,10 +180,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] + ) + cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -207,7 +207,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -223,7 +223,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,13 +231,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -250,7 +250,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments" + } @distributed_trace def get( @@ -287,10 +289,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] + ) + cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -303,9 +305,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -322,4 +324,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py index ece9fd34ccb4..d3286ad449f5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py @@ -47,9 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,9 +88,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,10 +161,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] + ) + cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -187,7 +187,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -203,7 +203,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -211,13 +211,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -230,7 +230,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls" + } @distributed_trace def get( @@ -260,10 +262,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] + ) + cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -275,9 +277,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -294,4 +296,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py index 6a5a0161789e..4e0c65184249 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,9 +77,9 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,10 +142,10 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] + ) + cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -167,7 +167,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -183,7 +183,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -191,13 +191,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RegulatoryComplianceStandardList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -210,7 +210,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" + } @distributed_trace def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _models.RegulatoryComplianceStandard: @@ -235,10 +237,10 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] + ) + cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) request = build_get_request( regulatory_compliance_standard_name=regulatory_compliance_standard_name, @@ -249,9 +251,9 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -268,4 +270,6 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py index a4ddd7978895..5fb21919cc2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py @@ -45,9 +45,9 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,9 +100,9 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str "subAssessmentName": _SERIALIZER.url("sub_assessment_name", sub_assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,10 +164,10 @@ def list_all(self, scope: str, **kwargs: Any) -> Iterable["_models.SecuritySubAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -188,7 +188,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -204,7 +204,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +212,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -231,7 +231,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} # type: ignore + list_all.metadata = {"url": "/{scope}/providers/Microsoft.Security/subAssessments"} @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_models.SecuritySubAssessment"]: @@ -253,10 +253,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] + ) + cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -278,7 +278,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -294,7 +294,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -302,13 +302,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySubAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -321,7 +321,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments"} @distributed_trace def get( @@ -354,10 +354,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2019-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2019-01-01-preview") - ) # type: Literal["2019-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] + ) + cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -369,9 +369,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -388,4 +388,6 @@ def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py index 0eef7f710a06..194b5d0e8368 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json index fb4dc9f00646..d7f4b984bafa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py index 355a95c07258..9c094a09dc58 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -69,7 +69,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -111,15 +111,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py index ad5b17e974bf..63f3bee448f3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py index aedc96bb370a..5eb9fdb4f2f9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -69,7 +69,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py index 9659bbd2cebc..8f30c8ed00eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/__init__.py @@ -17,7 +17,7 @@ from ._iot_security_solution_operations import IotSecuritySolutionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py index cbbc47d24a29..c35932eb0bb3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py @@ -78,8 +78,8 @@ def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.Device _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceSecurityGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} @distributed_trace_async async def get( @@ -172,8 +172,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -184,9 +184,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} @overload async def create_or_update( @@ -301,9 +301,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -325,9 +325,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,11 +344,13 @@ async def create_or_update( deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -377,8 +379,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -389,9 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,4 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py index d2a8e768d80e..b1fab1d6d21d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py @@ -82,8 +82,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -95,9 +95,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -114,7 +114,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels" + } @distributed_trace_async async def get( @@ -143,8 +145,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -156,9 +158,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,4 +177,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py index 864360becbec..b18c937632c6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py @@ -84,8 +84,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,7 +150,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def list_by_resource_group( @@ -174,8 +176,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -198,7 +200,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -214,7 +216,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -222,13 +224,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -241,7 +243,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace_async async def get( @@ -270,8 +274,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -283,9 +287,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -302,7 +306,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload async def create_or_update( @@ -399,9 +405,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +430,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +449,13 @@ async def create_or_update( deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload async def update( @@ -547,9 +555,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,9 +580,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +599,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -620,8 +630,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +643,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +658,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index 313373854892..8e655a3712b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -85,8 +85,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedAlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts" + } @distributed_trace_async async def get( @@ -185,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -199,9 +201,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,7 +220,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" + } @distributed_trace_async async def dismiss( # pylint: disable=inconsistent-return-statements @@ -249,8 +253,8 @@ async def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_dismiss_request( resource_group_name=resource_group_name, @@ -263,9 +267,9 @@ async def dismiss( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,4 +282,6 @@ async def dismiss( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss"} # type: ignore + dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py index 363466f760d9..d658762c9fa6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -92,8 +92,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -106,9 +106,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -125,7 +125,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}" + } @distributed_trace def list( @@ -151,8 +153,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +178,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +194,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,13 +202,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedRecommendationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -219,4 +221,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py index de83203b486b..e29bbfcaafc5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/__init__.py @@ -70,7 +70,7 @@ from ._security_center_enums import UnmaskedIpLoggingStatus from ._security_center_enums import ValueType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py index 9b2f75b45dcf..2c8a55b12d04 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -58,7 +58,7 @@ class CustomAlertRule(_serialization.Model): } } - def __init__(self, *, is_enabled: bool, **kwargs): + def __init__(self, *, is_enabled: bool, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -67,11 +67,12 @@ def __init__(self, *, is_enabled: bool, **kwargs): self.display_name = None self.description = None self.is_enabled = is_enabled - self.rule_type = None # type: Optional[str] + self.rule_type: Optional[str] = None class ThresholdCustomAlertRule(CustomAlertRule): - """A custom alert rule that checks if a value (depends on the custom alert type) is within the given range. + """A custom alert rule that checks if a value (depends on the custom alert type) is within the + given range. You probably want to use the sub-classes and not this class directly. Known sub-classes are: TimeWindowCustomAlertRule @@ -114,7 +115,7 @@ class ThresholdCustomAlertRule(CustomAlertRule): _subtype_map = {"rule_type": {"TimeWindowCustomAlertRule": "TimeWindowCustomAlertRule"}} - def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, **kwargs): + def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -124,13 +125,14 @@ def __init__(self, *, is_enabled: bool, min_threshold: int, max_threshold: int, :paramtype max_threshold: int """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "ThresholdCustomAlertRule" # type: str + self.rule_type: str = "ThresholdCustomAlertRule" self.min_threshold = min_threshold self.max_threshold = max_threshold class TimeWindowCustomAlertRule(ThresholdCustomAlertRule): - """A custom alert rule that checks if the number of activities (depends on the custom alert type) in a time window is within the given range. + """A custom alert rule that checks if the number of activities (depends on the custom alert type) + in a time window is within the given range. You probably want to use the sub-classes and not this class directly. Known sub-classes are: ActiveConnectionsNotInAllowedRange, AmqpC2DMessagesNotInAllowedRange, @@ -210,8 +212,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -223,7 +225,7 @@ def __init__( :paramtype time_window_size: ~datetime.timedelta """ super().__init__(is_enabled=is_enabled, min_threshold=min_threshold, max_threshold=max_threshold, **kwargs) - self.rule_type = "TimeWindowCustomAlertRule" # type: str + self.rule_type: str = "TimeWindowCustomAlertRule" self.time_window_size = time_window_size @@ -277,8 +279,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -296,7 +298,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "ActiveConnectionsNotInAllowedRange" # type: str + self.rule_type: str = "ActiveConnectionsNotInAllowedRange" class AdditionalWorkspacesProperties(_serialization.Model): @@ -323,8 +325,8 @@ def __init__( workspace: Optional[str] = None, type: Union[str, "_models.AdditionalWorkspaceType"] = "Sentinel", data_types: Optional[List[Union[str, "_models.AdditionalWorkspaceDataType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace: Workspace resource id. :paramtype workspace: str @@ -386,13 +388,13 @@ class ListCustomAlertRule(CustomAlertRule): } } - def __init__(self, *, is_enabled: bool, **kwargs): + def __init__(self, *, is_enabled: bool, **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "ListCustomAlertRule" # type: str + self.rule_type: str = "ListCustomAlertRule" self.value_type = None @@ -449,7 +451,7 @@ class AllowlistCustomAlertRule(ListCustomAlertRule): } } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -458,7 +460,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "AllowlistCustomAlertRule" # type: str + self.rule_type: str = "AllowlistCustomAlertRule" self.allowlist_values = allowlist_values @@ -512,8 +514,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -531,7 +533,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpC2DMessagesNotInAllowedRange" class AmqpC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -584,8 +586,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -603,7 +605,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpC2DRejectedMessagesNotInAllowedRange" class AmqpD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -656,8 +658,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -675,7 +677,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "AmqpD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "AmqpD2CMessagesNotInAllowedRange" class CloudErrorBody(_serialization.Model): @@ -711,7 +713,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -722,7 +724,8 @@ def __init__(self, **kwargs): class ConnectionFromIpNotAllowed(AllowlistCustomAlertRule): - """Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. + """Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in + CIDR notation. Variables are only populated by the server, and will be ignored when sending a request. @@ -762,7 +765,7 @@ class ConnectionFromIpNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -771,11 +774,12 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ConnectionFromIpNotAllowed" # type: str + self.rule_type: str = "ConnectionFromIpNotAllowed" class ConnectionToIpNotAllowed(AllowlistCustomAlertRule): - """Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. + """Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in + CIDR notation. Variables are only populated by the server, and will be ignored when sending a request. @@ -815,7 +819,7 @@ class ConnectionToIpNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -824,7 +828,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ConnectionToIpNotAllowed" # type: str + self.rule_type: str = "ConnectionToIpNotAllowed" class DenylistCustomAlertRule(ListCustomAlertRule): @@ -868,7 +872,7 @@ class DenylistCustomAlertRule(ListCustomAlertRule): "denylist_values": {"key": "denylistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -877,7 +881,7 @@ def __init__(self, *, is_enabled: bool, denylist_values: List[str], **kwargs): :paramtype denylist_values: list[str] """ super().__init__(is_enabled=is_enabled, **kwargs) - self.rule_type = "DenylistCustomAlertRule" # type: str + self.rule_type: str = "DenylistCustomAlertRule" self.denylist_values = denylist_values @@ -906,7 +910,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 @@ -961,8 +965,8 @@ def __init__( time_window_rules: Optional[List["_models.TimeWindowCustomAlertRule"]] = None, allowlist_rules: Optional[List["_models.AllowlistCustomAlertRule"]] = None, denylist_rules: Optional[List["_models.DenylistCustomAlertRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword threshold_rules: The list of custom alert threshold rules. :paramtype threshold_rules: @@ -1004,7 +1008,7 @@ class DeviceSecurityGroupList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DeviceSecurityGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeviceSecurityGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: List of device security group objects. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.DeviceSecurityGroup] @@ -1064,8 +1068,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1083,7 +1087,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "DirectMethodInvokesNotInAllowedRange" # type: str + self.rule_type: str = "DirectMethodInvokesNotInAllowedRange" class ErrorAdditionalInfo(_serialization.Model): @@ -1107,7 +1111,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 @@ -1164,8 +1168,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1183,7 +1187,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "FailedLocalLoginsNotInAllowedRange" # type: str + self.rule_type: str = "FailedLocalLoginsNotInAllowedRange" class FileUploadsNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1236,8 +1240,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1255,7 +1259,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "FileUploadsNotInAllowedRange" # type: str + self.rule_type: str = "FileUploadsNotInAllowedRange" class HttpC2DMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1308,8 +1312,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1327,7 +1331,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpC2DMessagesNotInAllowedRange" class HttpC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1380,8 +1384,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1399,7 +1403,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpC2DRejectedMessagesNotInAllowedRange" class HttpD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -1452,8 +1456,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -1471,7 +1475,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "HttpD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "HttpD2CMessagesNotInAllowedRange" class TagsResource(_serialization.Model): @@ -1485,7 +1489,7 @@ class TagsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1580,7 +1584,7 @@ class IoTSecurityAggregatedAlert(Resource, TagsResource): # pylint: disable=too }, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1629,7 +1633,7 @@ class IoTSecurityAggregatedAlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecurityAggregatedAlert"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecurityAggregatedAlert"], **kwargs: Any) -> None: """ :keyword value: List of aggregated alerts data. Required. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.IoTSecurityAggregatedAlert] @@ -1664,7 +1668,7 @@ class IoTSecurityAggregatedAlertPropertiesTopDevicesListItem(_serialization.Mode "last_occurrence": {"key": "lastOccurrence", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.device_id = None @@ -1740,7 +1744,9 @@ class IoTSecurityAggregatedRecommendation(Resource, TagsResource): # pylint: di "log_analytics_query": {"key": "properties.logAnalyticsQuery", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, recommendation_name: Optional[str] = None, **kwargs): + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, recommendation_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1789,7 +1795,7 @@ class IoTSecurityAggregatedRecommendationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecurityAggregatedRecommendation"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecurityAggregatedRecommendation"], **kwargs: Any) -> None: """ :keyword value: List of aggregated recommendations data. Required. :paramtype value: @@ -1821,7 +1827,7 @@ class IoTSecurityAlertedDevice(_serialization.Model): "alerts_count": {"key": "alertsCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.device_id = None @@ -1829,7 +1835,8 @@ def __init__(self, **kwargs): class IoTSecurityDeviceAlert(_serialization.Model): - """Statistical information about the number of alerts per alert type during last set number of days. + """Statistical information about the number of alerts per alert type during last set number of + days. Variables are only populated by the server, and will be ignored when sending a request. @@ -1854,7 +1861,7 @@ class IoTSecurityDeviceAlert(_serialization.Model): "alerts_count": {"key": "alertsCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.alert_display_name = None @@ -1863,7 +1870,8 @@ def __init__(self, **kwargs): class IoTSecurityDeviceRecommendation(_serialization.Model): - """Statistical information about the number of recommendations per device, per recommendation type. + """Statistical information about the number of recommendations per device, per recommendation + type. Variables are only populated by the server, and will be ignored when sending a request. @@ -1888,7 +1896,7 @@ class IoTSecurityDeviceRecommendation(_serialization.Model): "devices_count": {"key": "devicesCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.recommendation_display_name = None @@ -1962,8 +1970,8 @@ def __init__( top_alerted_devices: Optional[List["_models.IoTSecurityAlertedDevice"]] = None, most_prevalent_device_alerts: Optional[List["_models.IoTSecurityDeviceAlert"]] = None, most_prevalent_device_recommendations: Optional[List["_models.IoTSecurityDeviceRecommendation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword top_alerted_devices: List of the 3 devices with the most alerts. :paramtype top_alerted_devices: @@ -2009,7 +2017,7 @@ class IoTSecuritySolutionAnalyticsModelList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecuritySolutionAnalyticsModel"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecuritySolutionAnalyticsModel"], **kwargs: Any) -> None: """ :keyword value: List of Security analytics of your IoT Security solution. Required. :paramtype value: @@ -2039,8 +2047,8 @@ def __init__( *, date: Optional[datetime.datetime] = None, devices_metrics: Optional["_models.IoTSeverityMetrics"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date: Aggregation of IoT Security solution device alert metrics by date. :paramtype date: ~datetime.datetime @@ -2148,8 +2156,8 @@ def __init__( recommendations_configuration: Optional[List["_models.RecommendationConfigurationProperties"]] = None, unmasked_ip_logging_status: Union[str, "_models.UnmaskedIpLoggingStatus"] = "Disabled", additional_workspaces: Optional[List["_models.AdditionalWorkspacesProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2229,7 +2237,7 @@ class IoTSecuritySolutionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.IoTSecuritySolutionModel"], **kwargs): + def __init__(self, *, value: List["_models.IoTSecuritySolutionModel"], **kwargs: Any) -> None: """ :keyword value: List of IoT Security solutions. Required. :paramtype value: list[~azure.mgmt.security.v2019_08_01.models.IoTSecuritySolutionModel] @@ -2257,8 +2265,8 @@ class IoTSeverityMetrics(_serialization.Model): } def __init__( - self, *, high: Optional[int] = None, medium: Optional[int] = None, low: Optional[int] = None, **kwargs - ): + self, *, high: Optional[int] = None, medium: Optional[int] = None, low: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword high: Count of high severity alerts/recommendations. :paramtype high: int @@ -2314,7 +2322,7 @@ class LocalUserNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2323,7 +2331,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "LocalUserNotAllowed" # type: str + self.rule_type: str = "LocalUserNotAllowed" class MqttC2DMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2376,8 +2384,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2395,7 +2403,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttC2DMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttC2DMessagesNotInAllowedRange" class MqttC2DRejectedMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2448,8 +2456,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2467,7 +2475,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttC2DRejectedMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttC2DRejectedMessagesNotInAllowedRange" class MqttD2CMessagesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2520,8 +2528,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2539,7 +2547,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "MqttD2CMessagesNotInAllowedRange" # type: str + self.rule_type: str = "MqttD2CMessagesNotInAllowedRange" class ProcessNotAllowed(AllowlistCustomAlertRule): @@ -2583,7 +2591,7 @@ class ProcessNotAllowed(AllowlistCustomAlertRule): "allowlist_values": {"key": "allowlistValues", "type": "[str]"}, } - def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): + def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs: Any) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2592,7 +2600,7 @@ def __init__(self, *, is_enabled: bool, allowlist_values: List[str], **kwargs): :paramtype allowlist_values: list[str] """ super().__init__(is_enabled=is_enabled, allowlist_values=allowlist_values, **kwargs) - self.rule_type = "ProcessNotAllowed" # type: str + self.rule_type: str = "ProcessNotAllowed" class QueuePurgesNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2645,8 +2653,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2664,7 +2672,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "QueuePurgesNotInAllowedRange" # type: str + self.rule_type: str = "QueuePurgesNotInAllowedRange" class RecommendationConfigurationProperties(_serialization.Model): @@ -2706,8 +2714,8 @@ def __init__( *, recommendation_type: Union[str, "_models.RecommendationType"], status: Union[str, "_models.RecommendationConfigStatus"] = "Enabled", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword recommendation_type: The type of IoT Security recommendation. Required. Known values are: "IoT_ACRAuthentication", "IoT_AgentSendsUnutilizedMessages", "IoT_Baseline", @@ -2765,8 +2773,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 @@ -2842,8 +2850,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2861,7 +2869,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "TwinUpdatesNotInAllowedRange" # type: str + self.rule_type: str = "TwinUpdatesNotInAllowedRange" class UnauthorizedOperationsNotInAllowedRange(TimeWindowCustomAlertRule): @@ -2914,8 +2922,8 @@ def __init__( min_threshold: int, max_threshold: int, time_window_size: datetime.timedelta, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Status of the custom alert. Required. :paramtype is_enabled: bool @@ -2933,7 +2941,7 @@ def __init__( time_window_size=time_window_size, **kwargs ) - self.rule_type = "UnauthorizedOperationsNotInAllowedRange" # type: str + self.rule_type: str = "UnauthorizedOperationsNotInAllowedRange" class UpdateIotSecuritySolutionData(TagsResource): @@ -2965,8 +2973,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, user_defined_resources: Optional["_models.UserDefinedResourcesProperties"] = None, recommendations_configuration: Optional[List["_models.RecommendationConfigurationProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3007,7 +3015,7 @@ class UserDefinedResourcesProperties(_serialization.Model): "query_subscriptions": {"key": "querySubscriptions", "type": "[str]"}, } - def __init__(self, *, query: str, query_subscriptions: List[str], **kwargs): + def __init__(self, *, query: str, query_subscriptions: List[str], **kwargs: Any) -> None: """ :keyword query: Azure Resource Graph query which represents the security solution's user defined resources. Required to start with "where type != "Microsoft.Devices/IotHubs"". diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py index 4231c6d82e58..0f31acb84795 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/models/_security_center_enums.py @@ -35,15 +35,15 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DataSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DataSource.""" - #: Devices twin data TWIN_DATA = "TwinData" + """Devices twin data""" class ExportData(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExportData.""" - #: Agent raw events RAW_EVENTS = "RawEvents" + """Agent raw events""" class RecommendationConfigStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -58,50 +58,50 @@ class RecommendationConfigStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of IoT Security recommendation.""" - #: Authentication schema used for pull an edge module from an ACR repository does not use Service - #: Principal Authentication. IO_T_ACRAUTHENTICATION = "IoT_ACRAuthentication" - #: IoT agent message size capacity is currently underutilized, causing an increase in the number - #: of sent messages. Adjust message intervals for better utilization. + """Authentication schema used for pull an edge module from an ACR repository does not use Service + #: Principal Authentication.""" IO_T_AGENT_SENDS_UNUTILIZED_MESSAGES = "IoT_AgentSendsUnutilizedMessages" - #: Identified security related system configuration issues. + """IoT agent message size capacity is currently underutilized, causing an increase in the number + #: of sent messages. Adjust message intervals for better utilization.""" IO_T_BASELINE = "IoT_Baseline" - #: You can optimize Edge Hub memory usage by turning off protocol heads for any protocols not used - #: by Edge modules in your solution. + """Identified security related system configuration issues.""" IO_T_EDGE_HUB_MEM_OPTIMIZE = "IoT_EdgeHubMemOptimize" - #: Logging is disabled for this edge module. + """You can optimize Edge Hub memory usage by turning off protocol heads for any protocols not used + #: by Edge modules in your solution.""" IO_T_EDGE_LOGGING_OPTIONS = "IoT_EdgeLoggingOptions" - #: A minority within a device security group has inconsistent Edge Module settings with the rest - #: of their group. + """Logging is disabled for this edge module.""" IO_T_INCONSISTENT_MODULE_SETTINGS = "IoT_InconsistentModuleSettings" - #: Install the Azure Security of Things Agent. + """A minority within a device security group has inconsistent Edge Module settings with the rest + #: of their group.""" IO_T_INSTALL_AGENT = "IoT_InstallAgent" - #: IP Filter Configuration should have rules defined for allowed traffic and should deny all other - #: traffic by default. + """Install the Azure Security of Things Agent.""" IO_T_IPFILTER_DENY_ALL = "IoT_IPFilter_DenyAll" - #: An Allow IP Filter rules source IP range is too large. Overly permissive rules might expose - #: your IoT hub to malicious intenders. + """IP Filter Configuration should have rules defined for allowed traffic and should deny all other + #: traffic by default.""" IO_T_IPFILTER_PERMISSIVE_RULE = "IoT_IPFilter_PermissiveRule" - #: A listening endpoint was found on the device. + """An Allow IP Filter rules source IP range is too large. Overly permissive rules might expose + #: your IoT hub to malicious intenders.""" IO_T_OPEN_PORTS = "IoT_OpenPorts" - #: An Allowed firewall policy was found (INPUT/OUTPUT). The policy should Deny all traffic by - #: default and define rules to allow necessary communication to/from the device. + """A listening endpoint was found on the device.""" IO_T_PERMISSIVE_FIREWALL_POLICY = "IoT_PermissiveFirewallPolicy" - #: A rule in the firewall has been found that contains a permissive pattern for a wide range of IP - #: addresses or Ports. + """An Allowed firewall policy was found (INPUT/OUTPUT). The policy should Deny all traffic by + #: default and define rules to allow necessary communication to/from the device.""" IO_T_PERMISSIVE_INPUT_FIREWALL_RULES = "IoT_PermissiveInputFirewallRules" - #: A rule in the firewall has been found that contains a permissive pattern for a wide range of IP - #: addresses or Ports. + """A rule in the firewall has been found that contains a permissive pattern for a wide range of IP + #: addresses or Ports.""" IO_T_PERMISSIVE_OUTPUT_FIREWALL_RULES = "IoT_PermissiveOutputFirewallRules" - #: Edge module is configured to run in privileged mode, with extensive Linux capabilities or with - #: host-level network access (send/receive data to host machine). + """A rule in the firewall has been found that contains a permissive pattern for a wide range of IP + #: addresses or Ports.""" IO_T_PRIVILEGED_DOCKER_OPTIONS = "IoT_PrivilegedDockerOptions" - #: Same authentication credentials to the IoT Hub used by multiple devices. This could indicate an - #: illegitimate device impersonating a legitimate device. It also exposes the risk of device - #: impersonation by an attacker. + """Edge module is configured to run in privileged mode, with extensive Linux capabilities or with + #: host-level network access (send/receive data to host machine).""" IO_T_SHARED_CREDENTIALS = "IoT_SharedCredentials" - #: Insecure TLS configurations detected. Immediate upgrade recommended. + """Same authentication credentials to the IoT Hub used by multiple devices. This could indicate an + #: illegitimate device impersonating a legitimate device. It also exposes the risk of device + #: impersonation by an attacker.""" IO_T_VULNERABLE_TLS_CIPHER_SUITE = "IoT_VulnerableTLSCipherSuite" + """Insecure TLS configurations detected. Immediate upgrade recommended.""" class ReportedSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -123,16 +123,16 @@ class SecuritySolutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class UnmaskedIpLoggingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Unmasked IP address logging status.""" - #: Unmasked IP logging is disabled DISABLED = "Disabled" - #: Unmasked IP logging is enabled + """Unmasked IP logging is disabled""" ENABLED = "Enabled" + """Unmasked IP logging is enabled""" class ValueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The value type of the items in the list.""" - #: An IP range in CIDR format (e.g. '192.168.0.1/8'). IP_CIDR = "IpCidr" - #: Any string value. + """An IP range in CIDR format (e.g. '192.168.0.1/8').""" STRING = "String" + """Any string value.""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py index 9659bbd2cebc..8f30c8ed00eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/__init__.py @@ -17,7 +17,7 @@ from ._iot_security_solution_operations import IotSecuritySolutionOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py index 4d8448b0db33..87cbc13012bd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py @@ -45,7 +45,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,8 +96,8 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +138,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,8 +183,8 @@ def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.DeviceSecur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -205,7 +205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -221,7 +221,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,13 +229,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeviceSecurityGroupList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -248,7 +248,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups"} @distributed_trace def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) -> _models.DeviceSecurityGroup: @@ -275,8 +275,8 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -287,9 +287,9 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -306,7 +306,7 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} @overload def create_or_update( @@ -404,9 +404,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,9 +428,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -447,11 +447,13 @@ def create_or_update( deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -480,8 +482,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -492,9 +494,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,4 +509,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py index 4388c6b46011..949a677a614b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py @@ -45,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +63,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +78,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,8 +153,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -166,9 +166,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -185,7 +185,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels" + } @distributed_trace def get( @@ -214,8 +216,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -227,9 +229,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -246,4 +248,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py index 51e5cf8b82f6..c03582b6c8a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_by_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_list_by_resource_group_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +186,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +205,7 @@ def build_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,7 +224,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +242,7 @@ def build_delete_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -291,8 +291,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def list_by_resource_group( @@ -381,8 +383,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -405,7 +407,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -421,7 +423,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -429,13 +431,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecuritySolutionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -448,7 +450,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions" + } @distributed_trace def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _models.IoTSecuritySolutionModel: @@ -475,8 +479,8 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -488,9 +492,9 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,7 +511,9 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload def create_or_update( @@ -604,9 +610,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @overload def update( @@ -752,9 +760,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +785,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +804,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,8 +835,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -838,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -853,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index bee10b9a1908..f953883c6126 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -47,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +65,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,7 @@ def build_get_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +120,7 @@ def build_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_dismiss_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,8 +192,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -217,7 +217,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -233,7 +233,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -241,13 +241,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedAlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -260,7 +260,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts" + } @distributed_trace def get( @@ -292,8 +294,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -306,9 +308,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -325,7 +327,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" + } @distributed_trace def dismiss( # pylint: disable=inconsistent-return-statements @@ -356,8 +360,8 @@ def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_dismiss_request( resource_group_name=resource_group_name, @@ -370,9 +374,9 @@ def dismiss( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,4 +389,6 @@ def dismiss( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss"} # type: ignore + dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py index c29f12f7c3b0..c143feaa349b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -51,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +107,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +170,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -184,9 +184,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +203,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}" + } @distributed_trace def list( @@ -229,8 +231,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] + api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -254,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -270,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -278,13 +280,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IoTSecurityAggregatedRecommendationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -297,4 +299,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py index fa080065851b..64f740d2b832 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", "2020-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json index ba0549615a76..c4119e2e2f6d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py index cfe27e5eb433..5ec55d181902 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -106,7 +106,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -172,15 +172,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py index 9847128e0ae1..f80d5f1e3b1c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", "2020-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py index bffa59af0435..d36174c148e7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -106,7 +106,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py index 8f44c7940e4b..d0f4c9a78a25 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py @@ -23,7 +23,7 @@ from ._security_solutions_operations import SecuritySolutionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py index bfd1f3c2973c..dfa4ac91e899 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py @@ -86,8 +86,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -99,9 +99,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,7 +118,7 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} @distributed_trace_async async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: @@ -145,8 +145,8 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -158,9 +158,9 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -177,7 +177,9 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @overload async def put( @@ -265,9 +267,9 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,9 +292,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -309,7 +311,9 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -338,8 +342,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( asc_location=asc_location, @@ -351,9 +355,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -366,4 +370,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py index 42a8ec4659a4..1c19f0573396 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py @@ -89,8 +89,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +131,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AdaptiveNetworkHardeningsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + } @distributed_trace_async async def get( @@ -200,8 +202,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -216,9 +218,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,7 +237,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}" + } async def _enforce_initial( # pylint: disable=inconsistent-return-statements self, @@ -258,12 +262,12 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,9 +294,9 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -305,7 +309,9 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _enforce_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + _enforce_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } @overload async def begin_enforce( @@ -455,15 +461,15 @@ async def begin_enforce( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._enforce_initial( # type: ignore resource_group_name=resource_group_name, @@ -487,7 +493,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -499,6 +505,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enforce.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + begin_enforce.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py index cb341ce95ec9..09cec20e976e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AllowedConnectionsResour _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections" + } @distributed_trace_async async def get( @@ -266,8 +268,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -280,9 +282,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -299,4 +301,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py index e6ac957eedaa..a3f1e54db1fb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py @@ -79,8 +79,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace_async async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -168,8 +168,8 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -179,9 +179,9 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +198,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: @@ -214,8 +214,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +236,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +252,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +260,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -279,7 +279,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace_async async def get_in_subscription( @@ -306,8 +308,8 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -318,9 +320,9 @@ async def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -337,7 +339,9 @@ async def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload async def create_in_subscription( @@ -424,9 +428,9 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -448,9 +452,9 @@ async def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +471,9 @@ async def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace_async async def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -495,8 +501,8 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -507,9 +513,9 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -522,4 +528,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py index 1761db658ea4..d0d36c0f9057 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py @@ -80,8 +80,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAsse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace_async async def get( @@ -180,8 +180,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -193,9 +193,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +212,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload async def create_or_update( @@ -303,9 +303,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,9 +327,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -346,11 +346,11 @@ async def create_or_update( deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -379,8 +379,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -391,9 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -406,4 +406,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py index 48d2baa9aead..68dcc7918ed6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredSecuritySoluti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions" + } @distributed_trace_async async def get( @@ -260,8 +262,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -274,9 +276,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -293,4 +295,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py index 180037abff08..e49da1c7c58c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py @@ -76,8 +76,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExternalSecuritySolution _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,7 +141,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} @distributed_trace def list_by_home_region( @@ -162,8 +162,8 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions" + } @distributed_trace_async async def get( @@ -260,8 +262,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -274,9 +276,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -293,4 +295,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py index d5a6f0671157..330ca3f8b064 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py @@ -81,8 +81,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} @distributed_trace def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: @@ -166,8 +166,8 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -205,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -213,13 +213,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -232,7 +232,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group( @@ -254,8 +256,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +279,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +295,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +303,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +322,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group_and_region( @@ -345,8 +349,8 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -369,7 +373,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -385,7 +389,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -393,13 +397,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -412,7 +416,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group_and_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group_and_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace_async async def get( @@ -446,8 +452,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -460,9 +466,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +485,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload async def create_or_update( @@ -588,9 +596,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -614,9 +622,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +641,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -666,8 +676,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -680,9 +690,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -695,7 +705,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload async def initiate( @@ -816,12 +828,12 @@ async def initiate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -846,9 +858,9 @@ async def initiate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -865,4 +877,6 @@ async def initiate( return deserialized - initiate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore + initiate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py index 1666c3f2a99e..a9a7d7af47e4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py @@ -74,8 +74,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefini _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,7 +95,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -111,7 +111,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +119,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,7 +138,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: @@ -155,8 +155,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureSc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -177,7 +177,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -193,7 +193,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -201,13 +201,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -220,4 +220,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py index d935cbe380ac..7c34c6c9b877 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py @@ -78,8 +78,8 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +118,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -145,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_secure_score.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore + list_by_secure_score.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls" + } @distributed_trace def list( @@ -165,8 +167,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -188,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -204,7 +206,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +214,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -231,4 +233,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py index c4821406dd76..eef4aa404d3c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py @@ -72,8 +72,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +137,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} @distributed_trace_async async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: @@ -163,8 +163,8 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) request = build_get_request( secure_score_name=secure_score_name, @@ -175,9 +175,9 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -194,4 +194,6 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py index dd8c2bd37cad..3424b3848fce 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} @distributed_trace_async async def get( @@ -168,8 +168,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -182,9 +182,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,4 +201,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py index 5e79c73762c7..3e018804af72 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py @@ -78,8 +78,8 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -89,9 +89,9 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -108,7 +108,9 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" + } @distributed_trace_async async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -133,8 +135,8 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_by_home_region_request( asc_location=asc_location, @@ -145,9 +147,9 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,4 +166,6 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models return deserialized - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py index 3b7016783df2..53e820321c65 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py @@ -93,8 +93,8 @@ async def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, @@ -108,9 +108,9 @@ async def list_by_extended_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,7 +127,9 @@ async def list_by_extended_resource( return deserialized - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + } @distributed_trace_async async def get( @@ -164,11 +166,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -183,9 +183,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -202,7 +202,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace_async async def create_or_update( @@ -240,11 +242,9 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -259,9 +259,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,7 +278,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any @@ -294,11 +296,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -313,9 +313,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -328,7 +328,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace_async async def begin_delete( @@ -364,14 +366,12 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -392,9 +392,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -406,6 +406,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py index 8568c81fb33c..bd94c2a441b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: @@ -154,8 +154,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -177,7 +177,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -193,7 +193,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -201,13 +201,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -220,7 +220,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies" + } @distributed_trace_async async def get( @@ -252,8 +254,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -266,9 +268,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,4 +287,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py index 22cb443808b0..696464205ce0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py @@ -118,7 +118,7 @@ from ._security_center_enums import TransportProtocol from ._security_center_enums import UserImpact from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py index f912e7b9bdda..973f6bc5f9b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py @@ -31,8 +31,8 @@ class AadConnectivityState(_serialization.Model): } def __init__( - self, *, connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, **kwargs - ): + self, *, connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword connectivity_state: The connectivity state of the external AAD solution. Known values are: "Discovered", "NotLicensed", and "Connected". @@ -60,7 +60,7 @@ class Location(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -77,7 +77,9 @@ class ExternalSecuritySolutionKind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): + def __init__( + self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -112,7 +114,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 @@ -121,7 +123,8 @@ def __init__(self, **kwargs): class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location): - """Represents a security solution external to Microsoft Defender for Cloud which sends information to an OMS workspace and whose data is displayed by Microsoft Defender for Cloud. + """Represents a security solution external to Microsoft Defender for Cloud which sends information + to an OMS workspace and whose data is displayed by Microsoft Defender for Cloud. Variables are only populated by the server, and will be ignored when sending a request. @@ -152,7 +155,9 @@ class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location) "type": {"key": "type", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): + def __init__( + self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -206,8 +211,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.AadSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -247,8 +252,8 @@ def __init__( device_vendor: Optional[str] = None, device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -301,8 +306,8 @@ def __init__( device_vendor: Optional[str] = None, device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connectivity_state: The connectivity state of the external AAD solution. Known values are: "Discovered", "NotLicensed", and "Connected". @@ -405,8 +410,8 @@ def __init__( protection_mode: Optional["_models.ProtectionMode"] = None, vm_recommendations: Optional[List["_models.VmRecommendation"]] = None, path_recommendations: Optional[List["_models.PathRecommendation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enforcement_mode: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -436,7 +441,8 @@ def __init__( class AdaptiveApplicationControlGroups(_serialization.Model): - """Represents a list of VM/server groups and set of rules that are Recommended by Microsoft Defender for Cloud to be allowed. + """Represents a list of VM/server groups and set of rules that are Recommended by Microsoft + Defender for Cloud to be allowed. :ivar value: :vartype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] @@ -446,7 +452,9 @@ class AdaptiveApplicationControlGroups(_serialization.Model): "value": {"key": "value", "type": "[AdaptiveApplicationControlGroup]"}, } - def __init__(self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] @@ -476,8 +484,8 @@ def __init__( *, issue: Optional[Union[str, "_models.AdaptiveApplicationControlIssue"]] = None, number_of_vms: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword issue: An alert that machines within a group can have. Known values are: "ViolationsAudited", "ViolationsBlocked", "MsiAndScriptViolationsAudited", @@ -493,7 +501,8 @@ def __init__( class AdaptiveNetworkHardening(Resource): - """The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource. + """The resource whose properties describes the Adaptive Network Hardening settings for some Azure + resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -537,8 +546,8 @@ def __init__( rules: Optional[List["_models.Rule"]] = None, rules_calculation_time: Optional[datetime.datetime] = None, effective_network_security_groups: Optional[List["_models.EffectiveNetworkSecurityGroups"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rules: The security rules which are recommended to be effective on the VM. :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] @@ -578,7 +587,7 @@ class AdaptiveNetworkHardeningEnforceRequest(_serialization.Model): "network_security_groups": {"key": "networkSecurityGroups", "type": "[str]"}, } - def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs): + def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs: Any) -> None: """ :keyword rules: The rules to enforce. Required. :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] @@ -611,8 +620,8 @@ def __init__( *, value: Optional[List["_models.AdaptiveNetworkHardening"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: A list of Adaptive Network Hardenings resources. :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] @@ -645,7 +654,7 @@ class AllowedConnectionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -691,7 +700,7 @@ class AllowedConnectionsResource(Resource, Location): "connectable_resources": {"key": "properties.connectableResources", "type": "[ConnectableResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -719,7 +728,7 @@ class AssessmentLinks(_serialization.Model): "azure_portal_uri": {"key": "azurePortalUri", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.azure_portal_uri = None @@ -755,8 +764,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -812,8 +821,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.AtaSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -857,8 +866,8 @@ def __init__( device_type: Optional[str] = None, workspace: Optional["_models.ConnectedWorkspace"] = None, last_event_received: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -905,10 +914,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -935,10 +944,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -959,7 +968,7 @@ class AzureResourceLink(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1005,8 +1014,8 @@ def __init__( *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, properties: Optional["_models.CefSolutionProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -1058,8 +1067,8 @@ def __init__( hostname: Optional[str] = None, agent: Optional[str] = None, last_event_received: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1122,7 +1131,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1161,7 +1170,7 @@ class ConnectableResource(_serialization.Model): "outbound_connected_resources": {"key": "outboundConnectedResources", "type": "[ConnectedResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1194,7 +1203,7 @@ class ConnectedResource(_serialization.Model): "udp_ports": {"key": "udpPorts", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.connected_resource_id = None @@ -1213,7 +1222,7 @@ class ConnectedWorkspace(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure resource ID of the connected OMS workspace. :paramtype id: str @@ -1271,8 +1280,14 @@ class DiscoveredSecuritySolution(Resource, Location): } def __init__( - self, *, security_family: Union[str, "_models.SecurityFamily"], offer: str, publisher: str, sku: str, **kwargs - ): + self, + *, + security_family: Union[str, "_models.SecurityFamily"], + offer: str, + publisher: str, + sku: str, + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the discovered solution. Required. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -1315,7 +1330,7 @@ class DiscoveredSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.DiscoveredSecuritySolution] @@ -1340,8 +1355,12 @@ class EffectiveNetworkSecurityGroups(_serialization.Model): } def __init__( - self, *, network_interface: Optional[str] = None, network_security_groups: Optional[List[str]] = None, **kwargs - ): + self, + *, + network_interface: Optional[str] = None, + network_security_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword network_interface: The Azure resource ID of the network interface. :paramtype network_interface: str @@ -1375,7 +1394,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 @@ -1402,7 +1421,7 @@ class ExternalSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ExternalSecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ExternalSecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ExternalSecuritySolution] @@ -1432,7 +1451,7 @@ class JitNetworkAccessPoliciesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicy] @@ -1453,7 +1472,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1515,8 +1534,8 @@ def __init__( virtual_machines: List["_models.JitNetworkAccessPolicyVirtualMachine"], kind: Optional[str] = None, requests: Optional[List["_models.JitNetworkAccessRequest"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1569,8 +1588,8 @@ def __init__( number: int, end_time_utc: datetime.datetime, allowed_source_address_prefix: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1612,8 +1631,8 @@ def __init__( *, virtual_machines: List["_models.JitNetworkAccessPolicyInitiateVirtualMachine"], justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword virtual_machines: A list of virtual machines & ports to open access for. Required. :paramtype virtual_machines: @@ -1653,8 +1672,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessPolicyInitiatePort"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -1698,8 +1717,8 @@ def __init__( id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessPortRule"], public_ip_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -1757,8 +1776,8 @@ def __init__( max_request_access_duration: str, allowed_source_address_prefix: Optional[str] = None, allowed_source_address_prefixes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1819,8 +1838,8 @@ def __init__( start_time_utc: datetime.datetime, requestor: str, justification: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword virtual_machines: Required. :paramtype virtual_machines: @@ -1891,8 +1910,8 @@ def __init__( allowed_source_address_prefix: Optional[str] = None, allowed_source_address_prefixes: Optional[List[str]] = None, mapped_port: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword number: Required. :paramtype number: int @@ -1950,8 +1969,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin ports: List["_models.JitNetworkAccessRequestPort"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Resource ID of the virtual machine that is linked to this policy. Required. :paramtype id: str @@ -2002,7 +2021,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -2014,7 +2035,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -2072,8 +2093,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -2095,7 +2116,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -2152,8 +2173,8 @@ def __init__( usernames: Optional[List["_models.UserRecommendation"]] = None, file_type: Optional[Union[str, "_models.FileType"]] = None, configuration_status: Optional[Union[str, "_models.ConfigurationStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword path: The full path of the file, or an identifier of the application. :paramtype path: str @@ -2192,7 +2213,8 @@ def __init__( class ProtectionMode(_serialization.Model): - """The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used for Linux. + """The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, + Executable is used for Linux. :ivar exe: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -2222,8 +2244,8 @@ def __init__( msi: Optional[Union[str, "_models.EnforcementMode"]] = None, script: Optional[Union[str, "_models.EnforcementMode"]] = None, executable: Optional[Union[str, "_models.EnforcementMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword exe: The application control policy enforcement/protection mode of the machine group. Known values are: "Audit", "Enforce", and "None". @@ -2273,8 +2295,8 @@ def __init__( product_name: Optional[str] = None, binary_name: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher_name: The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = @@ -2295,7 +2317,8 @@ def __init__( class Rule(_serialization.Model): - """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote addresses are recommended to be blocked. + """Describes remote addresses that is recommended to communicate with the Azure resource on some + (Protocol, Port, Direction). All other remote addresses are recommended to be blocked. :ivar name: The name of the rule. :vartype name: str @@ -2330,8 +2353,8 @@ def __init__( destination_port: Optional[int] = None, protocols: Optional[List[Union[str, "_models.TransportProtocol"]]] = None, ip_addresses: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the rule. :paramtype name: str @@ -2400,7 +2423,7 @@ class SecureScoreControlDefinitionItem(Resource): "assessment_definitions": {"key": "properties.assessmentDefinitions", "type": "[AzureResourceLink]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.display_name = None @@ -2431,7 +2454,7 @@ class SecureScoreControlDefinitionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2450,7 +2473,7 @@ class SecureScoreControlDefinitionSource(_serialization.Model): "source_type": {"key": "sourceType", "type": "str"}, } - def __init__(self, *, source_type: Optional[Union[str, "_models.ControlType"]] = None, **kwargs): + def __init__(self, *, source_type: Optional[Union[str, "_models.ControlType"]] = None, **kwargs: Any) -> None: """ :keyword source_type: The type of security control (for example, BuiltIn). Known values are: "BuiltIn" and "Custom". @@ -2522,7 +2545,9 @@ class SecureScoreControlDetails(Resource): # pylint: disable=too-many-instance- "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__(self, *, definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, **kwargs): + def __init__( + self, *, definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, **kwargs: Any + ) -> None: """ :keyword definition: Information about the security control. :paramtype definition: ~azure.mgmt.security.v2020_01_01.models.SecureScoreControlDefinitionItem @@ -2560,7 +2585,7 @@ class SecureScoreControlList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2594,7 +2619,7 @@ class SecureScoreControlScore(_serialization.Model): "percentage": {"key": "percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.max = None @@ -2649,7 +2674,7 @@ class SecureScoreItem(Resource): "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.display_name = None @@ -2680,7 +2705,7 @@ class SecureScoresList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2743,8 +2768,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2020_01_01.models.ResourceDetails @@ -2789,7 +2814,7 @@ class SecurityAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2881,8 +2906,8 @@ def __init__( preview: Optional[bool] = None, assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -2951,7 +2976,7 @@ class SecurityAssessmentMetadataList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2983,7 +3008,7 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs): + def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3077,8 +3102,8 @@ def __init__( threats: Optional[List[Union[str, "_models.Threats"]]] = None, preview: Optional[bool] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -3147,7 +3172,7 @@ class SecurityAssessmentPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, **kwargs): + def __init__(self, *, partner_name: str, secret: str, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3209,8 +3234,8 @@ def __init__( provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, template: Optional[str] = None, protection_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the security solution. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -3254,7 +3279,7 @@ class SecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SecuritySolution"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SecuritySolution"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolution] @@ -3334,8 +3359,8 @@ def __init__( publisher: str, publisher_display_name: str, template: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword security_family: The security family of the security solution. Required. Known values are: "Waf", "Ngfw", "SaasWaf", and "Va". @@ -3378,7 +3403,9 @@ class SecuritySolutionsReferenceDataList(_serialization.Model): "value": {"key": "value", "type": "[SecuritySolutionsReferenceData]"}, } - def __init__(self, *, value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolutionsReferenceData] @@ -3419,7 +3446,7 @@ class ServerVulnerabilityAssessment(Resource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -3436,7 +3463,7 @@ class ServerVulnerabilityAssessmentsList(_serialization.Model): "value": {"key": "value", "type": "[ServerVulnerabilityAssessment]"}, } - def __init__(self, *, value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ServerVulnerabilityAssessment] @@ -3466,7 +3493,7 @@ class TopologyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3511,7 +3538,7 @@ class TopologyResource(Resource, Location): "topology_resources": {"key": "properties.topologyResources", "type": "[TopologySingleResource]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -3570,7 +3597,7 @@ class TopologySingleResource(_serialization.Model): "children": {"key": "children", "type": "[TopologySingleResourceChild]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3600,7 +3627,7 @@ class TopologySingleResourceChild(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3623,7 +3650,7 @@ class TopologySingleResourceParent(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None @@ -3650,8 +3677,8 @@ def __init__( *, username: Optional[str] = None, recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword username: Represents a user that is recommended to be allowed for a certain rule. :paramtype username: str @@ -3697,8 +3724,8 @@ def __init__( recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, resource_id: Optional[str] = None, enforcement_support: Optional[Union[str, "_models.EnforcementSupport"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration_status: The configuration status of the machines group or machine or rule. Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py index 3521c0d26140..71cd7a4099ea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py @@ -32,12 +32,12 @@ class AdaptiveApplicationControlIssue(str, Enum, metaclass=CaseInsensitiveEnumMe class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -45,16 +45,16 @@ class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): based on custom Azure Policy definition. """ - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: User defined policies that are automatically ingested from Azure Policy to Microsoft Defender - #: for Cloud + """Microsoft Defender for Cloud managed assessments""" CUSTOM_POLICY = "CustomPolicy" - #: User assessments pushed directly by the user or other third party to Microsoft Defender for - #: Cloud + """User defined policies that are automatically ingested from Azure Policy to Microsoft Defender + #: for Cloud""" CUSTOMER_MANAGED = "CustomerManaged" - #: An assessment that was created by a verified 3rd party if the user connected it to ASC + """User assessments pushed directly by the user or other third party to Microsoft Defender for + #: Cloud""" VERIFIED_PARTNER = "VerifiedPartner" + """An assessment that was created by a verified 3rd party if the user connected it to ASC""" class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -87,10 +87,10 @@ class ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of security control (for example, BuiltIn).""" - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: Non Microsoft Defender for Cloud managed assessments + """Microsoft Defender for Cloud managed assessments""" CUSTOM = "Custom" + """Non Microsoft Defender for Cloud managed assessments""" class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -119,17 +119,17 @@ class EnforcementSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExpandControlsEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandControlsEnum.""" - #: Add definition object for each control DEFINITION = "definition" + """Add definition object for each control""" class ExpandEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandEnum.""" - #: All links associated with an assessment LINKS = "links" - #: Assessment metadata + """All links associated with an assessment""" METADATA = "metadata" + """Assessment metadata""" class ExternalSecuritySolutionKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -233,12 +233,12 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class SourceSystem(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py index 8f44c7940e4b..d0f4c9a78a25 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py @@ -23,7 +23,7 @@ from ._security_solutions_operations import SecuritySolutionsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py index fff0749da585..d4eae95f37cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py @@ -49,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +114,8 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,7 +148,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,8 +220,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -233,9 +233,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -252,7 +252,7 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} @distributed_trace def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: @@ -279,8 +279,8 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( asc_location=asc_location, @@ -292,9 +292,9 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +311,9 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @overload def put( @@ -399,9 +401,9 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +426,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,7 +445,9 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -472,8 +476,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( asc_location=asc_location, @@ -485,9 +489,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,4 +504,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py index 306da09fb4c1..d3542134e281 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py @@ -54,7 +54,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,11 +143,11 @@ def build_enforce_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +173,7 @@ def build_enforce_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,8 +230,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -256,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -272,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -280,13 +280,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AdaptiveNetworkHardeningsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -299,7 +299,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" + } @distributed_trace def get( @@ -341,8 +343,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -357,9 +359,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,7 +378,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}" + } def _enforce_initial( # pylint: disable=inconsistent-return-statements self, @@ -399,12 +403,12 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -431,9 +435,9 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -446,7 +450,9 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _enforce_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + _enforce_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } @overload def begin_enforce( @@ -596,15 +602,15 @@ def begin_enforce( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop( + adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: Literal["enforce"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._enforce_initial( # type: ignore resource_group_name=resource_group_name, @@ -628,7 +634,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -640,6 +646,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enforce.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + begin_enforce.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py index 6929ecb0f58a..5a8f7cd2cb3a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,7 @@ def build_get_request( "connectionType": _SERIALIZER.url("connection_type", connection_type, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +170,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: @@ -254,8 +254,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +277,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +293,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +301,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AllowedConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +320,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections" + } @distributed_trace def get( @@ -358,8 +360,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -372,9 +374,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -391,4 +393,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py index 437167903c12..9945f0d7e514 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_create_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +198,7 @@ def build_delete_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +242,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -263,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -279,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -306,7 +306,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -331,8 +331,8 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -342,9 +342,9 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: @@ -377,8 +377,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +423,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +442,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: @@ -467,8 +469,8 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -479,9 +481,9 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -498,7 +500,9 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload def create_in_subscription( @@ -585,9 +589,9 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -609,9 +613,9 @@ def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -628,7 +632,9 @@ def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -656,8 +662,8 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -668,9 +674,9 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -683,4 +689,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py index 6ed562817062..8f19640a3e02 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,8 +183,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -205,7 +205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -221,7 +221,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,13 +229,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -248,7 +248,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace def get( @@ -283,8 +283,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -296,9 +296,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +315,7 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload def create_or_update( @@ -406,9 +406,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -430,9 +430,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -449,11 +449,11 @@ def create_or_update( deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -482,8 +482,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -494,9 +494,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -509,4 +509,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py index e5fc10eda33b..2e5d99582fe2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,8 +174,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +196,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +212,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +220,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: @@ -258,8 +258,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +281,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -297,7 +297,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -305,13 +305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiscoveredSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -324,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions" + } @distributed_trace def get( @@ -356,8 +358,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +372,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +391,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py index 00a0e84c865b..749008b84624 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,8 +174,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +196,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +212,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +220,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +239,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: @@ -258,8 +258,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +281,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -297,7 +297,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -305,13 +305,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ExternalSecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -324,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions" + } @distributed_trace def get( @@ -356,8 +358,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +372,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +391,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py index 6f6bd6431853..20dc808b38a8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +103,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +137,7 @@ def build_list_by_resource_group_and_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +155,7 @@ def build_list_by_resource_group_and_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +176,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +197,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,8 +218,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +240,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -263,7 +263,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +284,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,11 +305,11 @@ def build_initiate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +333,7 @@ def build_initiate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -379,8 +379,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} @distributed_trace def list_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: @@ -464,8 +464,8 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -487,7 +487,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -503,7 +503,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -511,13 +511,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -530,7 +530,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group( @@ -552,8 +554,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -575,7 +577,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -591,7 +593,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -599,13 +601,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -618,7 +620,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies" + } @distributed_trace def list_by_resource_group_and_region( @@ -643,8 +647,8 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -667,7 +671,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -683,7 +687,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -691,13 +695,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JitNetworkAccessPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -710,7 +714,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group_and_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group_and_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" + } @distributed_trace def get( @@ -744,8 +750,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -758,9 +764,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -777,7 +783,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload def create_or_update( @@ -886,9 +894,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -912,9 +920,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -931,7 +939,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -964,8 +974,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -978,9 +988,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -993,7 +1003,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" + } @overload def initiate( @@ -1114,12 +1126,12 @@ def initiate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop( + jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: Literal["initiate"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] + ) + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1144,9 +1156,9 @@ def initiate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1163,4 +1175,6 @@ def initiate( return deserialized - initiate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore + initiate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py index 3bb1cbd8d86d..fb6bb747c736 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +77,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,8 +121,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionI _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +142,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +158,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,13 +166,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -185,7 +185,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionItem"]: @@ -202,8 +202,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecureScoreCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,7 +224,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -240,7 +240,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -248,13 +248,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -267,4 +267,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py index e5720ed24935..8120267e2fe1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py @@ -51,7 +51,7 @@ def build_list_by_secure_score_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_by_secure_score_request( "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +85,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,8 +151,8 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -175,7 +175,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -191,7 +191,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -199,13 +199,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -218,7 +218,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_secure_score.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore + list_by_secure_score.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls" + } @distributed_trace def list( @@ -238,8 +240,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -261,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -277,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -285,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoreControlList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -304,4 +306,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py index 42a221dadd27..b7da91e18772 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +128,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -150,7 +150,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -166,7 +166,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -174,13 +174,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecureScoresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -193,7 +193,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} @distributed_trace def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: @@ -219,8 +219,8 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) request = build_get_request( secure_score_name=secure_score_name, @@ -231,9 +231,9 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,4 +250,6 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py index d32ce7c086dd..c66f6d9e697a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request( "securitySolutionName": _SERIALIZER.url("security_solution_name", security_solution_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +134,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -156,7 +156,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -172,7 +172,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -180,13 +180,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecuritySolutionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -199,7 +199,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} @distributed_trace def get( @@ -231,8 +231,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -245,9 +245,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -264,4 +264,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py index 44d4baec6c5a..8762517d4e67 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,8 +136,8 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -147,9 +147,9 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,7 +166,9 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" + } @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -191,8 +193,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_by_home_region_request( asc_location=asc_location, @@ -203,9 +205,9 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,4 +224,6 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur return deserialized - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py index f49d3fd4d88f..8be762c8dc3b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py @@ -52,7 +52,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,10 +94,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +118,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,10 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +164,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,10 +186,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +210,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,8 +271,8 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, @@ -292,9 +286,9 @@ def list_by_extended_resource( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -311,7 +305,9 @@ def list_by_extended_resource( return deserialized - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" + } @distributed_trace def get( @@ -348,11 +344,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -367,9 +361,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -386,7 +380,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace def create_or_update( @@ -424,11 +420,9 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -443,9 +437,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -462,7 +456,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any @@ -478,11 +474,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -497,9 +491,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -512,7 +506,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } @distributed_trace def begin_delete( @@ -548,14 +544,12 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop( - "server_vulnerability_assessment", "default" - ) # type: Literal["default"] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -576,9 +570,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -590,6 +584,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py index c0e23166eb5f..a08384eb63e3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +103,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_get_request( "topologyResourceName": _SERIALIZER.url("topology_resource_name", topology_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,8 +164,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -186,7 +186,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -202,7 +202,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -210,13 +210,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -229,7 +229,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} @distributed_trace def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.TopologyResource"]: @@ -246,8 +246,8 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -269,7 +269,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -285,7 +285,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -293,13 +293,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TopologyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -312,7 +312,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore + list_by_home_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies" + } @distributed_trace def get( @@ -344,8 +346,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -358,9 +360,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -377,4 +379,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py index 16b000307558..2291fa8addec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] + api_version: Literal["2020-01-01-preview"] = kwargs.pop("api_version", "2020-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json index 3e2097810054..202fd18686be 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py index c2ef228454d9..eac66137bec7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ConnectorsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py index 4c63533d8d8d..a264326b4945 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] + api_version: Literal["2020-01-01-preview"] = kwargs.pop("api_version", "2020-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py index 2c1984123c43..f30d89c1d5cf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py index 36717e9887ca..28d52bdd565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._connectors_operations import ConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py index e71f9e9c6b8e..889751c1a0dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py @@ -76,10 +76,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] + ) + cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConnectorSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} @distributed_trace_async async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: @@ -167,10 +167,10 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( connector_name=connector_name, @@ -181,9 +181,9 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -200,7 +200,7 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} @overload async def create_or_update( @@ -281,11 +281,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -307,9 +307,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -326,7 +326,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -352,10 +354,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( connector_name=connector_name, @@ -366,9 +368,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,4 +383,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py index 4d965dbf3b31..ddfe12e9e53d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py @@ -25,7 +25,7 @@ from ._security_center_enums import HybridComputeProvisioningState from ._security_center_enums import PermissionProperty from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py index 7b508a23d1f2..6723a290455e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -61,16 +61,20 @@ class AuthenticationDetailsProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.authentication_provisioning_state = None self.granted_permissions = None - self.authentication_type = None # type: Optional[str] + self.authentication_type: Optional[str] = None class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsProperties): - """AWS cloud account connector based assume role, the role enables delegating access to your AWS resources. The role is composed of role Amazon Resource Name (ARN) and external ID. For more details, refer to :code:`Creating a Role to Delegate Permissions to an IAM User (write only)`. + """AWS cloud account connector based assume role, the role enables delegating access to your AWS + resources. The role is composed of role Amazon Resource Name (ARN) and external ID. For more + details, refer to :code:`Creating + a Role to Delegate Permissions to an IAM User (write only)`. Variables are only populated by the server, and will be ignored when sending a request. @@ -116,7 +120,7 @@ class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsPropertie "aws_external_id": {"key": "awsExternalId", "type": "str"}, } - def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs): + def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs: Any) -> None: """ :keyword aws_assume_role_arn: Assumed role ID is an identifier that you can use to create temporary security credentials. Required. @@ -126,14 +130,17 @@ def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs): :paramtype aws_external_id: str """ super().__init__(**kwargs) - self.authentication_type = "awsAssumeRole" # type: str + self.authentication_type: str = "awsAssumeRole" self.account_id = None self.aws_assume_role_arn = aws_assume_role_arn self.aws_external_id = aws_external_id class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): - """AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more details, refer to :code:`Creating an IAM User in Your AWS Account (write only)`. + """AWS cloud account connector based credentials, the credentials is composed of access key ID and + secret key, for more details, refer to :code:`Creating an IAM + User in Your AWS Account (write only)`. Variables are only populated by the server, and will be ignored when sending a request. @@ -179,7 +186,7 @@ class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): "aws_secret_access_key": {"key": "awsSecretAccessKey", "type": "str"}, } - def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwargs): + def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwargs: Any) -> None: """ :keyword aws_access_key_id: Public key element of the AWS credential object (write only). Required. @@ -189,7 +196,7 @@ def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwar :paramtype aws_secret_access_key: str """ super().__init__(**kwargs) - self.authentication_type = "awsCreds" # type: str + self.authentication_type: str = "awsCreds" self.account_id = None self.aws_access_key_id = aws_access_key_id self.aws_secret_access_key = aws_secret_access_key @@ -229,7 +236,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -264,7 +271,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 @@ -318,8 +325,8 @@ def __init__( *, hybrid_compute_settings: Optional["_models.HybridComputeSettingsProperties"] = None, authentication_details: Optional["_models.AuthenticationDetailsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hybrid_compute_settings: Settings for hybrid compute management. These settings are relevant only for Arc autoProvision (Hybrid Compute). @@ -355,7 +362,7 @@ class ConnectorSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ConnectorSetting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ConnectorSetting"]] = None, **kwargs: Any) -> None: """ :keyword value: List of all the cloud account connector settings. :paramtype value: list[~azure.mgmt.security.v2020_01_01_preview.models.ConnectorSetting] @@ -386,7 +393,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 @@ -394,7 +401,8 @@ def __init__(self, **kwargs): class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): # pylint: disable=too-many-instance-attributes - """GCP cloud account connector based service to service credentials, the credentials are composed of the organization ID and a JSON API key (write only). + """GCP cloud account connector based service to service credentials, the credentials are composed + of the organization ID and a JSON API key (write only). Variables are only populated by the server, and will be ignored when sending a request. @@ -486,8 +494,8 @@ def __init__( token_uri: str, auth_provider_x509_cert_url: str, client_x509_cert_url: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organization_id: The organization ID of the GCP cloud account. Required. :paramtype organization_id: str @@ -515,7 +523,7 @@ def __init__( :paramtype client_x509_cert_url: str """ super().__init__(**kwargs) - self.authentication_type = "gcpCredentials" # type: str + self.authentication_type: str = "gcpCredentials" self.organization_id = organization_id self.type = type self.project_id = project_id @@ -578,8 +586,8 @@ def __init__( region: Optional[str] = None, proxy_server: Optional["_models.ProxyServerProperties"] = None, service_principal: Optional["_models.ServicePrincipalProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auto_provision: Whether or not to automatically install Azure Arc (hybrid compute) agents on machines. Required. Known values are: "On" and "Off". @@ -607,7 +615,8 @@ def __init__( class ProxyServerProperties(_serialization.Model): - """For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure machine can use. + """For a non-Azure machine that is not connected directly to the internet, specify a proxy server + that the non-Azure machine can use. :ivar ip: Proxy server IP. :vartype ip: str @@ -620,7 +629,7 @@ class ProxyServerProperties(_serialization.Model): "port": {"key": "port", "type": "str"}, } - def __init__(self, *, ip: Optional[str] = None, port: Optional[str] = None, **kwargs): + def __init__(self, *, ip: Optional[str] = None, port: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ip: Proxy server IP. :paramtype ip: str @@ -647,7 +656,7 @@ class ServicePrincipalProperties(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, application_id: Optional[str] = None, secret: Optional[str] = None, **kwargs): + def __init__(self, *, application_id: Optional[str] = None, secret: Optional[str] = None, **kwargs: Any) -> None: """ :keyword application_id: Application ID of service principal. :paramtype application_id: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py index 9c10c4fb9804..ba41abf7907c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py @@ -13,14 +13,14 @@ class AuthenticationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the multi-cloud connector.""" - #: Valid connector VALID = "Valid" - #: Invalid connector + """Valid connector""" INVALID = "Invalid" - #: the connection has expired + """Invalid connector""" EXPIRED = "Expired" - #: Incorrect policy of the connector + """the connection has expired""" INCORRECT_POLICY = "IncorrectPolicy" + """Incorrect policy of the connector""" class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -28,43 +28,43 @@ class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): authentication. For GCP use account organization credentials. """ - #: AWS cloud account connector user credentials authentication AWS_CREDS = "awsCreds" - #: AWS account connector assume role authentication + """AWS cloud account connector user credentials authentication""" AWS_ASSUME_ROLE = "awsAssumeRole" - #: GCP account connector service to service authentication + """AWS account connector assume role authentication""" GCP_CREDENTIALS = "gcpCredentials" + """GCP account connector service to service authentication""" class AutoProvision(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether or not to automatically install Azure Arc (hybrid compute) agents on machines.""" - #: Install missing Azure Arc agents on machines automatically ON = "On" - #: Do not install Azure Arc agent on the machines automatically + """Install missing Azure Arc agents on machines automatically""" OFF = "Off" + """Do not install Azure Arc agent on the machines automatically""" class HybridComputeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the service principal and its secret.""" - #: Valid service principal details. VALID = "Valid" - #: Invalid service principal details. + """Valid service principal details.""" INVALID = "Invalid" - #: the service principal details are expired + """Invalid service principal details.""" EXPIRED = "Expired" + """the service principal details are expired""" class PermissionProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A permission detected in the cloud account.""" - #: This permission provides read only access to AWS Security Hub resources. AWS_AWS_SECURITY_HUB_READ_ONLY_ACCESS = "AWS::AWSSecurityHubReadOnlyAccess" - #: This permission grants access to read security configuration metadata. + """This permission provides read only access to AWS Security Hub resources.""" AWS_SECURITY_AUDIT = "AWS::SecurityAudit" - #: The permission provides for EC2 Automation service to execute activities defined within - #: Automation documents. + """This permission grants access to read security configuration metadata.""" AWS_AMAZON_SSM_AUTOMATION_ROLE = "AWS::AmazonSSMAutomationRole" - #: This permission provides read only access to GCP Security Command Center. + """The permission provides for EC2 Automation service to execute activities defined within + #: Automation documents.""" GCP_SECURITY_CENTER_ADMIN_VIEWER = "GCP::Security Center Admin Viewer" + """This permission provides read only access to GCP Security Command Center.""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py index 36717e9887ca..28d52bdd565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._connectors_operations import ConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py index f23c32136df7..83fca6c89120 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(connector_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request(connector_name: str, subscription_id: str, **kwargs: Any) "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,10 +104,10 @@ def build_create_or_update_request(connector_name: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_create_or_update_request(connector_name: str, subscription_id: str, ** "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,9 +138,9 @@ def build_delete_request(connector_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request(connector_name: str, subscription_id: str, **kwargs: An "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,10 +197,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] + ) + cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -221,7 +221,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -237,7 +237,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -245,13 +245,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConnectorSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -264,7 +264,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} @distributed_trace def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: @@ -288,10 +288,10 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( connector_name=connector_name, @@ -302,9 +302,9 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +321,7 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} @overload def create_or_update( @@ -402,11 +402,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,9 +428,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -447,7 +447,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + } @distributed_trace def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -471,10 +473,10 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-01-01-preview") - ) # type: Literal["2020-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( connector_name=connector_name, @@ -485,9 +487,9 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,4 +502,4 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py index e26ff92bc8dd..fc405211c560 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] + api_version: Literal["2020-07-01-preview"] = kwargs.pop("api_version", "2020-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json index 097b59763bc9..35e311e5127d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json @@ -19,7 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -36,22 +37,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -59,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py index fd77680bb793..54a54854ed71 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -55,7 +55,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -91,15 +91,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py index b5b327f05486..78d73e6c4290 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py @@ -40,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] + api_version: Literal["2020-07-01-preview"] = kwargs.pop("api_version", "2020-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py index 9b2ad9c252a1..cfdbc08a0dab 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -55,7 +55,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py index 869887473bbe..d5f860621913 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._sql_vulnerability_assessment_baseline_rules_operations import SqlVulnerabilityAssessmentBaselineRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 3c06e26616f4..105874af4175 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -166,11 +166,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -196,9 +196,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -215,7 +215,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RuleResults: @@ -245,10 +247,10 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( rule_id=rule_id, @@ -260,9 +262,9 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,7 +281,9 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -311,10 +315,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( rule_id=rule_id, @@ -326,9 +330,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -341,7 +345,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace_async async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RulesResults: @@ -369,10 +375,10 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -383,9 +389,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -402,7 +408,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } @overload async def add( @@ -499,11 +507,11 @@ async def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -528,9 +536,9 @@ async def add( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -547,4 +555,6 @@ async def add( return deserialized - add.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + add.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index f8a77971452d..d9f2422bc3b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -88,10 +88,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] + ) + cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -104,9 +104,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -123,7 +123,9 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" + } @distributed_trace_async async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.ScanResults: @@ -154,10 +156,10 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] + ) + cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( scan_id=scan_id, @@ -169,9 +171,9 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -188,4 +190,6 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index dd43e5060c63..318bd6779198 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -84,10 +84,10 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] + ) + cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -99,9 +99,9 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,7 +118,9 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}" + } @distributed_trace_async async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scans: @@ -146,10 +148,10 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] + ) + cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -160,9 +162,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -179,4 +181,4 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py index 97bf09e33a17..f92a3a9e77b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/__init__.py @@ -33,7 +33,7 @@ from ._security_center_enums import ScanState from ._security_center_enums import ScanTriggerType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py index 84a7a75cf28b..1c208f07adb8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -36,8 +36,8 @@ def __init__( *, expected_results: Optional[List[List[str]]] = None, updated_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expected_results: Expected results. :paramtype expected_results: list[list[str]] @@ -77,8 +77,8 @@ def __init__( status: Optional[Union[str, "_models.RuleStatus"]] = None, results_not_in_baseline: Optional[List[List[str]]] = None, results_only_in_baseline: Optional[List[List[str]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword baseline: Baseline details. :paramtype baseline: ~azure.mgmt.security.v2020_07_01_preview.models.Baseline @@ -111,7 +111,7 @@ class BenchmarkReference(_serialization.Model): "reference": {"key": "reference", "type": "str"}, } - def __init__(self, *, benchmark: Optional[str] = None, reference: Optional[str] = None, **kwargs): + def __init__(self, *, benchmark: Optional[str] = None, reference: Optional[str] = None, **kwargs: Any) -> None: """ :keyword benchmark: The benchmark name. :paramtype benchmark: str @@ -157,7 +157,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -188,7 +188,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 @@ -218,8 +218,8 @@ def __init__( query: Optional[str] = None, expected_result: Optional[List[List[str]]] = None, column_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query: The rule query. :paramtype query: str @@ -261,8 +261,8 @@ def __init__( scripts: Optional[List[str]] = None, automated: Optional[bool] = None, portal_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: Remediation description. :paramtype description: str @@ -305,7 +305,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 @@ -341,7 +341,7 @@ class RuleResults(Resource): "properties": {"key": "properties", "type": "RuleResultsProperties"}, } - def __init__(self, *, properties: Optional["_models.RuleResultsProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.RuleResultsProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Rule results properties. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.RuleResultsProperties @@ -365,7 +365,9 @@ class RuleResultsInput(_serialization.Model): "results": {"key": "results", "type": "[[str]]"}, } - def __init__(self, *, latest_scan: Optional[bool] = None, results: Optional[List[List[str]]] = None, **kwargs): + def __init__( + self, *, latest_scan: Optional[bool] = None, results: Optional[List[List[str]]] = None, **kwargs: Any + ) -> None: """ :keyword latest_scan: Take results from latest scan. :paramtype latest_scan: bool @@ -389,7 +391,7 @@ class RuleResultsProperties(_serialization.Model): "results": {"key": "results", "type": "[[str]]"}, } - def __init__(self, *, results: Optional[List[List[str]]] = None, **kwargs): + def __init__(self, *, results: Optional[List[List[str]]] = None, **kwargs: Any) -> None: """ :keyword results: Expected results in the baseline. :paramtype results: list[list[str]] @@ -409,7 +411,7 @@ class RulesResults(_serialization.Model): "value": {"key": "value", "type": "[RuleResults]"}, } - def __init__(self, *, value: Optional[List["_models.RuleResults"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RuleResults"]] = None, **kwargs: Any) -> None: """ :keyword value: List of rule results. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.RuleResults] @@ -434,8 +436,8 @@ class RulesResultsInput(_serialization.Model): } def __init__( - self, *, latest_scan: Optional[bool] = None, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs - ): + self, *, latest_scan: Optional[bool] = None, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs: Any + ) -> None: """ :keyword latest_scan: Take results from latest scan. :paramtype latest_scan: bool @@ -476,7 +478,7 @@ class Scan(Resource): "properties": {"key": "properties", "type": "ScanProperties"}, } - def __init__(self, *, properties: Optional["_models.ScanProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ScanProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: A vulnerability assessment scan record properties. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.ScanProperties @@ -553,8 +555,8 @@ def __init__( total_failed_rules_count: Optional[int] = None, total_rules_count: Optional[int] = None, is_baseline_applied: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring". :paramtype trigger_type: str or ~azure.mgmt.security.v2020_07_01_preview.models.ScanTriggerType @@ -631,7 +633,7 @@ class ScanResult(Resource): "properties": {"key": "properties", "type": "ScanResultProperties"}, } - def __init__(self, *, properties: Optional["_models.ScanResultProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ScanResultProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: A vulnerability assessment scan result properties for a single rule. :paramtype properties: ~azure.mgmt.security.v2020_07_01_preview.models.ScanResultProperties @@ -681,8 +683,8 @@ def __init__( remediation: Optional["_models.Remediation"] = None, baseline_adjusted_result: Optional["_models.BaselineAdjustedResult"] = None, rule_metadata: Optional["_models.VaRule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_id: The rule Id. :paramtype rule_id: str @@ -722,7 +724,7 @@ class ScanResults(_serialization.Model): "value": {"key": "value", "type": "[ScanResult]"}, } - def __init__(self, *, value: Optional[List["_models.ScanResult"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ScanResult"]] = None, **kwargs: Any) -> None: """ :keyword value: List of vulnerability assessment scan results. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.ScanResult] @@ -742,7 +744,7 @@ class Scans(_serialization.Model): "value": {"key": "value", "type": "[Scan]"}, } - def __init__(self, *, value: Optional[List["_models.Scan"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Scan"]] = None, **kwargs: Any) -> None: """ :keyword value: List of vulnerability assessment scan records. :paramtype value: list[~azure.mgmt.security.v2020_07_01_preview.models.Scan] @@ -801,8 +803,8 @@ def __init__( rationale: Optional[str] = None, query_check: Optional["_models.QueryCheck"] = None, benchmark_references: Optional[List["_models.BenchmarkReference"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_id: The rule Id. :paramtype rule_id: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py index 7661e82307b1..a75012e95df4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/models/_security_center_enums.py @@ -13,59 +13,59 @@ class RuleSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule severity.""" - #: High HIGH = "High" - #: Medium + """High""" MEDIUM = "Medium" - #: Low + """Medium""" LOW = "Low" - #: Informational + """Low""" INFORMATIONAL = "Informational" - #: Obsolete + """Informational""" OBSOLETE = "Obsolete" + """Obsolete""" class RuleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule result status.""" - #: NonFinding NON_FINDING = "NonFinding" - #: Finding + """NonFinding""" FINDING = "Finding" - #: InternalError + """Finding""" INTERNAL_ERROR = "InternalError" + """InternalError""" class RuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule type.""" - #: Binary BINARY = "Binary" - #: BaselineExpected + """Binary""" BASELINE_EXPECTED = "BaselineExpected" - #: PositiveList + """BaselineExpected""" POSITIVE_LIST = "PositiveList" - #: NegativeList + """PositiveList""" NEGATIVE_LIST = "NegativeList" + """NegativeList""" class ScanState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scan status.""" - #: Failed FAILED = "Failed" - #: FailedToRun + """Failed""" FAILED_TO_RUN = "FailedToRun" - #: InProgress + """FailedToRun""" IN_PROGRESS = "InProgress" - #: Passed + """InProgress""" PASSED = "Passed" + """Passed""" class ScanTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scan trigger type.""" - #: OnDemand ON_DEMAND = "OnDemand" - #: Recurring + """OnDemand""" RECURRING = "Recurring" + """Recurring""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py index 869887473bbe..d5f860621913 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._sql_vulnerability_assessment_baseline_rules_operations import SqlVulnerabilityAssessmentBaselineRulesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index cfa641f0db7a..48b57983f35c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -43,10 +43,10 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,9 +77,9 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -108,9 +108,9 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -139,9 +139,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -168,10 +168,10 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +182,7 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -320,11 +320,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,9 +350,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -369,7 +369,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + create_or_update.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RuleResults: @@ -399,10 +401,10 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] + ) + cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( rule_id=rule_id, @@ -414,9 +416,9 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,7 +435,9 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -465,10 +469,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( rule_id=rule_id, @@ -480,9 +484,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -495,7 +499,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"} # type: ignore + delete.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + } @distributed_trace def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.RulesResults: @@ -523,10 +529,10 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -537,9 +543,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -556,7 +562,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } @overload def add( @@ -653,11 +661,11 @@ def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -682,9 +690,9 @@ def add( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -701,4 +709,6 @@ def add( return deserialized - add.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules"} # type: ignore + add.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index 7b5825a52b1e..76b4de6ccd8b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -45,9 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_get_request( "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,9 +77,9 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -156,10 +156,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] + ) + cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -172,9 +172,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,7 +191,9 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" + } @distributed_trace def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.ScanResults: @@ -222,10 +224,10 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] + ) + cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( scan_id=scan_id, @@ -237,9 +239,9 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,4 +258,6 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults"} # type: ignore + list.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index 67b1fb530b27..eb26beaf8c90 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -43,9 +43,9 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -73,9 +73,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -146,10 +146,10 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] + ) + cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( scan_id=scan_id, @@ -161,9 +161,9 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -180,7 +180,9 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}"} # type: ignore + get.metadata = { + "url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}" + } @distributed_trace def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scans: @@ -208,10 +210,10 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2020-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2020-07-01-preview") - ) # type: Literal["2020-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] + ) + cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( resource_id=resource_id, @@ -222,9 +224,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -241,4 +243,4 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc return deserialized - list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} # type: ignore + list.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py index dc619b6e3a5e..931f3cd30b8d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json index 174825493d37..18561670e4bf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py index 3c5681588d3a..5bfeed8bfe19 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py index e6a65f1057b1..13d4593305c6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py index 6bee95b3d333..63fc56312a42 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py index 0d4651467be4..4e8d6bdd1b1a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py @@ -86,8 +86,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,7 +151,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -168,8 +168,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -191,7 +191,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -207,7 +207,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -215,13 +215,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -234,7 +234,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -252,8 +254,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -275,7 +277,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -291,7 +293,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -299,13 +301,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -318,7 +320,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -341,8 +345,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -365,7 +369,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -381,7 +385,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -389,13 +393,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -408,7 +412,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace_async async def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -435,8 +441,8 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -448,9 +454,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +473,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def get_resource_group_level( @@ -499,8 +507,8 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( asc_location=asc_location, @@ -513,9 +521,9 @@ async def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -532,7 +540,9 @@ async def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -561,8 +571,8 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -574,9 +584,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +599,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -618,8 +630,8 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -631,9 +643,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -646,7 +658,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -675,8 +689,8 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -688,9 +702,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -703,7 +717,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -735,8 +751,8 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( asc_location=asc_location, @@ -749,9 +765,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -764,7 +780,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -796,8 +814,8 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( asc_location=asc_location, @@ -810,9 +828,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -825,7 +843,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -857,8 +877,8 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( asc_location=asc_location, @@ -871,9 +891,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -886,7 +906,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } async def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -905,9 +927,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -929,9 +951,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -944,7 +966,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload async def begin_simulate( @@ -1045,12 +1069,12 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1069,10 +1093,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1084,6 +1108,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py index 27a235f46f19..f0a4dbee8e8f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/__init__.py @@ -26,7 +26,7 @@ from ._security_center_enums import KindEnum from ._security_center_enums import ResourceIdentifierType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py index 2518d4a817ac..9d786f4b09c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py @@ -48,7 +48,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 @@ -190,8 +190,8 @@ class Alert(Resource): # pylint: disable=too-many-instance-attributes } def __init__( # pylint: disable=too-many-locals - self, *, extended_properties: Optional[Dict[str, str]] = None, **kwargs - ): + self, *, extended_properties: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: """ :keyword extended_properties: Custom properties for the alert. :paramtype extended_properties: dict[str, str] @@ -243,7 +243,7 @@ class AlertEntity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -274,7 +274,7 @@ class AlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs: Any) -> None: """ :keyword value: describes security alert properties. :paramtype value: list[~azure.mgmt.security.v2021_01_01.models.Alert] @@ -310,7 +310,7 @@ class AlertSimulatorRequestProperties(_serialization.Model): _subtype_map = {"kind": {"Bundles": "AlertSimulatorBundlesRequestProperties"}} - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -318,7 +318,7 @@ def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, ** """ super().__init__(**kwargs) self.additional_properties = additional_properties - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSimulatorBundlesRequestProperties(AlertSimulatorRequestProperties): @@ -350,8 +350,8 @@ def __init__( *, additional_properties: Optional[Dict[str, Any]] = None, bundles: Optional[List[Union[str, "_models.BundleType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -360,7 +360,7 @@ def __init__( :paramtype bundles: list[str or ~azure.mgmt.security.v2021_01_01.models.BundleType] """ super().__init__(additional_properties=additional_properties, **kwargs) - self.kind = "Bundles" # type: str + self.kind: str = "Bundles" self.bundles = bundles @@ -375,7 +375,9 @@ class AlertSimulatorRequestBody(_serialization.Model): "properties": {"key": "properties", "type": "AlertSimulatorRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Alert Simulator request body data. :paramtype properties: ~azure.mgmt.security.v2021_01_01.models.AlertSimulatorRequestProperties @@ -385,7 +387,8 @@ def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestPropert class ResourceIdentifier(_serialization.Model): - """A resource identifier for an alert which can be used to direct the alert to the right product exposure group (tenant, workspace, subscription etc.). + """A resource identifier for an alert which can be used to direct the alert to the right product + exposure group (tenant, workspace, subscription etc.). You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureResourceIdentifier, LogAnalyticsIdentifier @@ -407,10 +410,10 @@ class ResourceIdentifier(_serialization.Model): _subtype_map = {"type": {"AzureResource": "AzureResourceIdentifier", "LogAnalytics": "LogAnalyticsIdentifier"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AzureResourceIdentifier(ResourceIdentifier): @@ -437,10 +440,10 @@ class AzureResourceIdentifier(ResourceIdentifier): "azure_resource_id": {"key": "azureResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "AzureResource" # type: str + self.type: str = "AzureResource" self.azure_resource_id = None @@ -477,7 +480,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -508,7 +511,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 @@ -557,10 +560,10 @@ class LogAnalyticsIdentifier(ResourceIdentifier): "agent_id": {"key": "agentId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "LogAnalytics" # type: str + self.type: str = "LogAnalytics" self.workspace_id = None self.workspace_subscription_id = None self.workspace_resource_group = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py index 7ecd17e3f093..7b1c5b3762c3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_security_center_enums.py @@ -15,25 +15,25 @@ class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. """ - #: Informational INFORMATIONAL = "Informational" - #: Low + """Informational""" LOW = "Low" - #: Medium + """Low""" MEDIUM = "Medium" - #: High + """Medium""" HIGH = "High" + """High""" class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The life cycle status of the alert.""" - #: An alert which doesn't specify a value is assigned the status 'Active' ACTIVE = "Active" - #: Alert closed after handling + """An alert which doesn't specify a value is assigned the status 'Active'""" RESOLVED = "Resolved" - #: Alert dismissed as false positive + """Alert closed after handling""" DISMISSED = "Dismissed" + """Alert dismissed as false positive""" class BundleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -54,65 +54,65 @@ class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): of Azure Security Center's supported kill chain intents. """ - #: Unknown UNKNOWN = "Unknown" - #: PreAttack could be either an attempt to access a certain resource regardless of a malicious + """Unknown""" + PRE_ATTACK = "PreAttack" + """PreAttack could be either an attempt to access a certain resource regardless of a malicious #: intent, or a failed attempt to gain access to a target system to gather information prior to #: exploitation. This step is usually detected as an attempt, originating from outside the #: network, to scan the target system and find a way in. Further details on the PreAttack stage - #: can be read in `MITRE Pre-Att&ck matrix `_. - PRE_ATTACK = "PreAttack" - #: InitialAccess is the stage where an attacker manages to get foothold on the attacked resource. + #: can be read in `MITRE Pre-Att&ck matrix `_.""" INITIAL_ACCESS = "InitialAccess" - #: Persistence is any access, action, or configuration change to a system that gives a threat - #: actor a persistent presence on that system. + """InitialAccess is the stage where an attacker manages to get foothold on the attacked resource.""" PERSISTENCE = "Persistence" - #: Privilege escalation is the result of actions that allow an adversary to obtain a higher level - #: of permissions on a system or network. + """Persistence is any access, action, or configuration change to a system that gives a threat + #: actor a persistent presence on that system.""" PRIVILEGE_ESCALATION = "PrivilegeEscalation" - #: Defense evasion consists of techniques an adversary may use to evade detection or avoid other - #: defenses. + """Privilege escalation is the result of actions that allow an adversary to obtain a higher level + #: of permissions on a system or network.""" DEFENSE_EVASION = "DefenseEvasion" - #: Credential access represents techniques resulting in access to or control over system, domain, - #: or service credentials that are used within an enterprise environment. + """Defense evasion consists of techniques an adversary may use to evade detection or avoid other + #: defenses.""" CREDENTIAL_ACCESS = "CredentialAccess" - #: Discovery consists of techniques that allow the adversary to gain knowledge about the system - #: and internal network. + """Credential access represents techniques resulting in access to or control over system, domain, + #: or service credentials that are used within an enterprise environment.""" DISCOVERY = "Discovery" - #: Lateral movement consists of techniques that enable an adversary to access and control remote - #: systems on a network and could, but does not necessarily, include execution of tools on remote - #: systems. + """Discovery consists of techniques that allow the adversary to gain knowledge about the system + #: and internal network.""" LATERAL_MOVEMENT = "LateralMovement" - #: The execution tactic represents techniques that result in execution of adversary-controlled - #: code on a local or remote system. + """Lateral movement consists of techniques that enable an adversary to access and control remote + #: systems on a network and could, but does not necessarily, include execution of tools on remote + #: systems.""" EXECUTION = "Execution" - #: Collection consists of techniques used to identify and gather information, such as sensitive - #: files, from a target network prior to exfiltration. + """The execution tactic represents techniques that result in execution of adversary-controlled + #: code on a local or remote system.""" COLLECTION = "Collection" - #: Exfiltration refers to techniques and attributes that result or aid in the adversary removing - #: files and information from a target network. + """Collection consists of techniques used to identify and gather information, such as sensitive + #: files, from a target network prior to exfiltration.""" EXFILTRATION = "Exfiltration" - #: The command and control tactic represents how adversaries communicate with systems under their - #: control within a target network. + """Exfiltration refers to techniques and attributes that result or aid in the adversary removing + #: files and information from a target network.""" COMMAND_AND_CONTROL = "CommandAndControl" - #: Impact events primarily try to directly reduce the availability or integrity of a system, - #: service, or network; including manipulation of data to impact a business or operational - #: process. + """The command and control tactic represents how adversaries communicate with systems under their + #: control within a target network.""" IMPACT = "Impact" - #: Probing could be either an attempt to access a certain resource regardless of a malicious - #: intent, or a failed attempt to gain access to a target system to gather information prior to - #: exploitation. + """Impact events primarily try to directly reduce the availability or integrity of a system, + #: service, or network; including manipulation of data to impact a business or operational + #: process.""" PROBING = "Probing" - #: Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. - #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc. + """Probing could be either an attempt to access a certain resource regardless of a malicious + #: intent, or a failed attempt to gain access to a target system to gather information prior to + #: exploitation.""" EXPLOITATION = "Exploitation" + """Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. + #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc.""" class KindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of alert simulation.""" - #: Simulate alerts according to bundles BUNDLES = "Bundles" + """Simulate alerts according to bundles""" class ResourceIdentifierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py index b96170f2f9d9..ac67f844cf95 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py @@ -47,7 +47,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,7 @@ def build_get_resource_group_level_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +258,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -341,7 +341,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -360,7 +360,7 @@ def build_update_resource_group_level_state_to_resolve_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -377,7 +377,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -396,7 +396,7 @@ def build_update_resource_group_level_state_to_dismiss_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -413,7 +413,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +432,7 @@ def build_update_resource_group_level_state_to_activate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -447,8 +447,8 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -463,7 +463,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -507,8 +507,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -529,7 +529,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -545,7 +545,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -553,13 +553,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -572,7 +572,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -589,8 +589,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -612,7 +612,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -628,7 +628,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -636,13 +636,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -655,7 +655,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -673,8 +675,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -696,7 +698,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -712,7 +714,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -720,13 +722,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -739,7 +741,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -762,8 +766,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -786,7 +790,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -802,7 +806,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -810,13 +814,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -829,7 +833,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -856,8 +862,8 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -869,9 +875,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -888,7 +894,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def get_resource_group_level( @@ -920,8 +928,8 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( asc_location=asc_location, @@ -934,9 +942,9 @@ def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -953,7 +961,9 @@ def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -982,8 +992,8 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -995,9 +1005,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1010,7 +1020,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1039,8 +1051,8 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -1052,9 +1064,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1067,7 +1079,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1096,8 +1110,8 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -1109,9 +1123,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1124,7 +1138,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1156,8 +1172,8 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( asc_location=asc_location, @@ -1170,9 +1186,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1185,7 +1201,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1217,8 +1235,8 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( asc_location=asc_location, @@ -1231,9 +1249,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1246,7 +1264,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1278,8 +1298,8 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( asc_location=asc_location, @@ -1292,9 +1312,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1307,7 +1327,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1326,9 +1348,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1350,9 +1372,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1365,7 +1387,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload def begin_simulate( @@ -1466,12 +1490,12 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1490,9 +1514,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1504,6 +1528,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py index 29eb554b4669..6ed4f0ee5795 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] + api_version: Literal["2021-01-15-preview"] = kwargs.pop("api_version", "2021-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json index 44fe3aad2097..f6245c812961 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py index 4aa5c10b58ce..855e8da4368e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import IngestionSettingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py index ed15395c07e2..d5a61c66e7b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] + api_version: Literal["2021-01-15-preview"] = kwargs.pop("api_version", "2021-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py index e50ff084bfd9..e6e92c0c0b5d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import IngestionSettingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py index af84327affac..e0aa0c4329cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._ingestion_settings_operations import IngestionSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py index 783c50fa9756..c373b19a42d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] + ) + cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("IngestionSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} @distributed_trace_async async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: @@ -171,10 +171,10 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) request = build_get_request( ingestion_setting_name=ingestion_setting_name, @@ -185,9 +185,9 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,9 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @overload async def create( @@ -287,11 +289,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -313,9 +315,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,7 +334,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -358,10 +362,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( ingestion_setting_name=ingestion_setting_name, @@ -372,9 +376,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -387,7 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace_async async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: @@ -412,10 +418,10 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] + ) + cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) request = build_list_tokens_request( ingestion_setting_name=ingestion_setting_name, @@ -426,9 +432,9 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -445,7 +451,9 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode return deserialized - list_tokens.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens"} # type: ignore + list_tokens.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" + } @distributed_trace_async async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: @@ -469,10 +477,10 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] + ) + cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) request = build_list_connection_strings_request( ingestion_setting_name=ingestion_setting_name, @@ -483,9 +491,9 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -502,4 +510,6 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py index 35a794f76866..439fe0cadcea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py @@ -15,7 +15,7 @@ from ._models_py3 import IngestionSettingToken from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py index a653aa7d1ce6..3b276818e2d8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys -from typing import Any, List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization @@ -16,6 +16,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -53,7 +57,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +84,7 @@ class ConnectionStrings(_serialization.Model): "value": {"key": "value", "type": "[IngestionConnectionString]"}, } - def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs): + def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs: Any) -> None: """ :keyword value: Connection strings. Required. :paramtype value: @@ -111,7 +115,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 @@ -139,7 +143,7 @@ class IngestionConnectionString(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.location = None @@ -171,7 +175,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 @@ -207,7 +211,7 @@ class IngestionSetting(Resource): "properties": {"key": "properties", "type": "object"}, } - def __init__(self, *, properties: Optional[JSON] = None, **kwargs): + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword properties: Ingestion setting data. :paramtype properties: JSON @@ -237,7 +241,7 @@ class IngestionSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -262,7 +266,7 @@ class IngestionSettingToken(_serialization.Model): "token": {"key": "token", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.token = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py index af84327affac..e0aa0c4329cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._ingestion_settings_operations import IngestionSettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py index b59efd30e6fd..b6bf091766a1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwarg "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_request(ingestion_setting_name: str, subscription_id: str, **kw "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,9 +140,9 @@ def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kw "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,9 +172,9 @@ def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,9 +206,9 @@ def build_list_connection_strings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +223,7 @@ def build_list_connection_strings_request( "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,10 +267,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] + ) + cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -291,7 +291,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -307,7 +307,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -315,13 +315,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("IngestionSettingList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -334,7 +334,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} @distributed_trace def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: @@ -359,10 +359,10 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) request = build_get_request( ingestion_setting_name=ingestion_setting_name, @@ -373,9 +373,9 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -392,7 +392,9 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @overload def create( @@ -475,11 +477,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -501,9 +503,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -520,7 +522,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -546,10 +550,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( ingestion_setting_name=ingestion_setting_name, @@ -560,9 +564,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -575,7 +579,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" + } @distributed_trace def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: @@ -600,10 +606,10 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] + ) + cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) request = build_list_tokens_request( ingestion_setting_name=ingestion_setting_name, @@ -614,9 +620,9 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +639,9 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing return deserialized - list_tokens.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens"} # type: ignore + list_tokens.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" + } @distributed_trace def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: @@ -657,10 +665,10 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-01-15-preview") - ) # type: Literal["2021-01-15-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] + ) + cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) request = build_list_connection_strings_request( ingestion_setting_name=ingestion_setting_name, @@ -671,9 +679,9 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -690,4 +698,6 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> return deserialized - list_connection_strings.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings"} # type: ignore + list_connection_strings.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py index 3614699fc08f..c99cb4ba72ed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] + api_version: Literal["2021-05-01-preview"] = kwargs.pop("api_version", "2021-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json index 51725a878d15..52975dbb5d13 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py index b8f322040926..427b471e349d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SoftwareInventoriesOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py index 938dfefc1977..60efdbca3565 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] + api_version: Literal["2021-05-01-preview"] = kwargs.pop("api_version", "2021-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py index 38a819cef40a..d5527f3a483e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SoftwareInventoriesOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py index e7e69c997540..7bacc485fce7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._software_inventories_operations import SoftwareInventoriesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py index efd086d3f9d3..d88d411affed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py @@ -86,10 +86,10 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,7 +157,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Software"]: @@ -172,10 +174,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Software _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +198,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +214,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +222,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +241,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace_async async def get( @@ -280,10 +284,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] + ) + cls: ClsType[_models.Software] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -298,9 +302,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +321,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py index b98811f9a86c..75809ee4c6fa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import EndOfSupportStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py index 86b4572d6192..40293222c062 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -50,7 +50,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -81,7 +81,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 @@ -113,7 +113,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 @@ -189,8 +189,8 @@ def __init__( end_of_support_date: Optional[str] = None, number_of_known_vulnerabilities: Optional[int] = None, first_seen_at: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword device_id: Unique identifier for the virtual machine in the service. :paramtype device_id: str @@ -247,7 +247,7 @@ class SoftwaresList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Software"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Software"]] = None, **kwargs: Any) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2021_05_01_preview.models.Software] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py index e7e69c997540..7bacc485fce7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._software_inventories_operations import SoftwareInventoriesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py index 1cb5f3c1fad4..aa3e9df00754 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py @@ -52,9 +52,9 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,9 +89,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,9 +127,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_get_request( "softwareName": _SERIALIZER.url("software_name", software_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,10 +203,10 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -231,7 +231,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -247,7 +247,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -255,13 +255,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -274,7 +274,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_extended_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Software"]: @@ -288,10 +290,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Software"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] + ) + cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -312,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -328,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -336,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SoftwaresList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -355,7 +357,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories" + } @distributed_trace def get( @@ -396,10 +400,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-05-01-preview") - ) # type: Literal["2021-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] + ) + cls: ClsType[_models.Software] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -414,9 +418,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -433,4 +437,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py index a751a5a17000..11f9ff4b52af 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", "2021-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json index 79bc9c66c629..1aad3ca349cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py index f665df89b9c3..e939a0b85f29 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AssessmentsMetadataOperations, AssessmentsOperations, SettingsOperations @@ -53,7 +53,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,15 +85,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py index dd03c6205884..b30183a57923 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", "2021-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py index 436951dc7106..2be3e4bfdac1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AssessmentsMetadataOperations, AssessmentsOperations, SettingsOperations @@ -53,7 +53,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py index 560b419352e7..11c9d4115be9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._assessments_operations import AssessmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py index dcb5a52502f5..ae0eb23ef525 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py @@ -79,8 +79,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +124,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,7 +143,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace_async async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadataResponse: @@ -168,8 +168,8 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -179,9 +179,9 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +198,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadataResponse"]: @@ -214,8 +214,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +236,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +252,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,13 +260,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -279,7 +279,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace_async async def get_in_subscription( @@ -306,8 +308,8 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -318,9 +320,9 @@ async def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -337,7 +339,9 @@ async def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload async def create_in_subscription( @@ -425,9 +429,9 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -449,9 +453,9 @@ async def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -468,7 +472,9 @@ async def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace_async async def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -496,8 +502,8 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -508,9 +514,9 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -523,4 +529,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py index c212a1adcd27..e2c8e527e2f3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py @@ -81,8 +81,8 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAsse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace_async async def get( @@ -181,8 +181,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -194,9 +194,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -213,7 +213,7 @@ async def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload async def create_or_update( @@ -304,9 +304,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -328,9 +328,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -347,11 +347,11 @@ async def create_or_update( deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -380,8 +380,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -392,9 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -407,4 +407,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py index a26ac7f2970e..b9ec501a18ce 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py index cf002ba6c053..fed88292bc78 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/__init__.py @@ -49,7 +49,7 @@ from ._security_center_enums import Threats from ._security_center_enums import UserImpact from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py index 9697815fecc0..4f876f6c77d6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -41,7 +41,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 @@ -86,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -127,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -154,7 +154,7 @@ class AssessmentLinks(_serialization.Model): "azure_portal_uri": {"key": "azurePortalUri", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.azure_portal_uri = None @@ -190,8 +190,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -249,8 +249,8 @@ def __init__( code: Union[str, "_models.AssessmentStatusCode"], cause: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Programmatic code for the status of the assessment. Required. Known values are: "Healthy", "Unhealthy", and "NotApplicable". @@ -288,10 +288,10 @@ class ResourceDetails(_serialization.Model): _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = None # type: Optional[str] + self.source: Optional[str] = None class AzureResourceDetails(ResourceDetails): @@ -318,10 +318,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.source = "Azure" # type: str + self.source: str = "Azure" self.id = None @@ -358,7 +358,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -403,13 +403,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -434,7 +434,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 @@ -480,7 +480,9 @@ class OnPremiseResourceDetails(ResourceDetails): _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): + def __init__( + self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -492,7 +494,7 @@ def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, m :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = "OnPremise" # type: str + self.source: str = "OnPremise" self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -550,8 +552,8 @@ def __init__( machine_name: str, server_name: str, database_name: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -573,7 +575,7 @@ def __init__( machine_name=machine_name, **kwargs ) - self.source = "OnPremiseSql" # type: str + self.source: str = "OnPremiseSql" self.server_name = server_name self.database_name = database_name @@ -634,8 +636,8 @@ def __init__( metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, status: Optional["_models.AssessmentStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -680,7 +682,7 @@ class SecurityAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -772,8 +774,8 @@ def __init__( preview: Optional[bool] = None, assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -846,7 +848,7 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs): + def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -940,8 +942,8 @@ def __init__( threats: Optional[List[Union[str, "_models.Threats"]]] = None, preview: Optional[bool] = None, partner_data: Optional["_models.SecurityAssessmentMetadataPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -1087,8 +1089,8 @@ def __init__( planned_deprecation_date: Optional[str] = None, tactics: Optional[List[Union[str, "_models.Tactics"]]] = None, techniques: Optional[List[Union[str, "_models.Techniques"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. Required. :paramtype display_name: str @@ -1171,7 +1173,7 @@ class SecurityAssessmentMetadataPropertiesResponsePublishDates(_serialization.Mo "public": {"key": "public", "type": "str"}, } - def __init__(self, *, public: str, ga: Optional[str] = None, **kwargs): + def __init__(self, *, public: str, ga: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ga: :paramtype ga: str @@ -1289,8 +1291,8 @@ def __init__( planned_deprecation_date: Optional[str] = None, tactics: Optional[List[Union[str, "_models.Tactics"]]] = None, techniques: Optional[List[Union[str, "_models.Techniques"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: User friendly display name of the assessment. :paramtype display_name: str @@ -1373,7 +1375,7 @@ class SecurityAssessmentMetadataResponseList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1401,7 +1403,7 @@ class SecurityAssessmentPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__(self, *, partner_name: str, secret: str, **kwargs): + def __init__(self, *, partner_name: str, secret: str, **kwargs: Any) -> None: """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -1456,8 +1458,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1526,8 +1528,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1599,8 +1601,8 @@ def __init__( additional_data: Optional[Dict[str, str]] = None, metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. Required. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1680,8 +1682,8 @@ def __init__( metadata: Optional["_models.SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["_models.SecurityAssessmentPartnerData"] = None, status: Optional["_models.AssessmentStatusResponse"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_details: Details of the resource that was assessed. :paramtype resource_details: ~azure.mgmt.security.v2021_06_01.models.ResourceDetails @@ -1725,7 +1727,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2021_06_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py index 4326c66f40e8..af224976fe8e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/models/_security_center_enums.py @@ -13,12 +13,12 @@ class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" - #: The resource is healthy HEALTHY = "Healthy" - #: The resource has a security issue that needs to be addressed + """The resource is healthy""" UNHEALTHY = "Unhealthy" - #: Assessment for this resource did not happen + """The resource has a security issue that needs to be addressed""" NOT_APPLICABLE = "NotApplicable" + """Assessment for this resource did not happen""" class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -26,16 +26,16 @@ class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): based on custom Azure Policy definition. """ - #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" - #: User defined policies that are automatically ingested from Azure Policy to Microsoft Defender - #: for Cloud + """Microsoft Defender for Cloud managed assessments""" CUSTOM_POLICY = "CustomPolicy" - #: User assessments pushed directly by the user or other third party to Microsoft Defender for - #: Cloud + """User defined policies that are automatically ingested from Azure Policy to Microsoft Defender + #: for Cloud""" CUSTOMER_MANAGED = "CustomerManaged" - #: An assessment that was created by a verified 3rd party if the user connected it to ASC + """User assessments pushed directly by the user or other third party to Microsoft Defender for + #: Cloud""" VERIFIED_PARTNER = "VerifiedPartner" + """An assessment that was created by a verified 3rd party if the user connected it to ASC""" class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -59,10 +59,10 @@ class Enum1(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExpandEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandEnum.""" - #: All links associated with an assessment LINKS = "links" - #: Assessment metadata + """All links associated with an assessment""" METADATA = "metadata" + """Assessment metadata""" class ImplementationEffort(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -92,12 +92,12 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform where the assessed resource resides.""" - #: Resource is in Azure AZURE = "Azure" - #: Resource in an on premise machine connected to Azure cloud + """Resource is in Azure""" ON_PREMISE = "OnPremise" - #: SQL Resource in an on premise machine connected to Azure cloud + """Resource in an on premise machine connected to Azure cloud""" ON_PREMISE_SQL = "OnPremiseSql" + """SQL Resource in an on premise machine connected to Azure cloud""" class Tactics(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py index 560b419352e7..11c9d4115be9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/__init__.py @@ -11,7 +11,7 @@ from ._assessments_operations import AssessmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py index adb88f6af608..06cc3a617726 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py @@ -45,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_get_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +148,8 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_create_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +198,7 @@ def build_delete_in_subscription_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,8 +242,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -263,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -279,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,13 +287,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -306,7 +306,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} @distributed_trace def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadataResponse: @@ -331,8 +331,8 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( assessment_metadata_name=assessment_metadata_name, @@ -342,9 +342,9 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +361,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA return deserialized - get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataResponse"]: @@ -377,8 +377,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +423,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentMetadataResponseList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +442,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" + } @distributed_trace def get_in_subscription( @@ -469,8 +471,8 @@ def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -481,9 +483,9 @@ def get_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -500,7 +502,9 @@ def get_in_subscription( return deserialized - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @overload def create_in_subscription( @@ -588,9 +592,9 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -612,9 +616,9 @@ def create_in_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +635,9 @@ def create_in_subscription( return deserialized - create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + create_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } @distributed_trace def delete_in_subscription( # pylint: disable=inconsistent-return-statements @@ -659,8 +665,8 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -671,9 +677,9 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -686,4 +692,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore + delete_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py index 1c27f11a49ec..84dd114162e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py @@ -45,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +184,8 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -206,7 +206,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -222,7 +222,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -230,13 +230,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityAssessmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -249,7 +249,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} @distributed_trace def get( @@ -284,8 +284,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( resource_id=resource_id, @@ -297,9 +297,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -316,7 +316,7 @@ def get( return deserialized - get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @overload def create_or_update( @@ -407,9 +407,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -431,9 +431,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -450,11 +450,11 @@ def create_or_update( deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -483,8 +483,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_id=resource_id, @@ -495,9 +495,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -510,4 +510,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py index bb9185702e90..9ed3517ca953 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +71,7 @@ def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +100,8 @@ def build_update_request(setting_name: Union[str, _models.Enum1], subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_update_request(setting_name: Union[str, _models.Enum1], subscription_i "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,8 +159,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -181,7 +181,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -197,7 +197,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -205,13 +205,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -224,7 +224,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: @@ -249,8 +249,8 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -261,9 +261,9 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -280,7 +280,7 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -362,9 +362,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -386,9 +386,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -405,4 +405,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py index 9194a3328c1b..54f911a1dc08 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json index efc901abd95d..912f306173a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py index 3dc330c4f3f9..adb2e5071775 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py index f3efe1774dd1..9275091da426 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", "2021-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py index de5852103e68..16fa3a8eb747 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py index fa070305ec9f..a06e991ae2b4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py index 63e5f8c91733..ce862c57b5f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py @@ -17,7 +17,7 @@ from ._security_center_enums import SettingKind from ._security_center_enums import SettingName from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py index 614e2db39baa..2cbfde35592d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class Resource(_serialization.Model): """Describes an Azure resource. @@ -37,7 +41,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 @@ -82,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -123,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -166,7 +170,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -211,13 +215,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -242,7 +246,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 @@ -269,7 +273,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2021_07_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py index e5e076466b76..c082dfd923f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +104,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,8 +163,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -253,8 +253,8 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -265,9 +265,9 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -284,7 +284,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -366,9 +366,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -390,9 +390,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -409,4 +409,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py index ff11a8f61b7d..5e3789643869 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json index 374729f3205b..9f045af2d917 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py index 3cd90ad4ba88..ce74378c220f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -59,7 +59,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -95,15 +95,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py index 5e96849ba4bc..e13c808ad346 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] + api_version: Literal["2021-07-01-preview"] = kwargs.pop("api_version", "2021-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py index 3ae750e64250..cd85b88cf12b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -59,7 +59,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py index f8be4db79c2f..395581c73e89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py index 1a0c4fffaf31..c117bc9495ae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py @@ -94,10 +94,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -109,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -128,7 +128,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @overload async def create( @@ -234,11 +236,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,9 +263,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -280,11 +282,13 @@ async def create( deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -315,10 +319,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -330,9 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,7 +349,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def list_by_resource_group( @@ -368,10 +374,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -393,7 +399,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -409,7 +415,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -417,13 +423,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -436,7 +442,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAssessmentAutomation"]: @@ -454,10 +462,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -478,7 +486,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -494,7 +502,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -502,13 +510,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -521,4 +529,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py index 389ec974975e..14f1be47b9b7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py @@ -95,10 +95,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -110,9 +110,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +129,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @overload async def create( @@ -237,11 +239,11 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -266,9 +268,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,11 +287,13 @@ async def create( deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -321,10 +325,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -336,9 +340,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -351,7 +355,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def list_by_resource_group( @@ -374,10 +380,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -399,7 +405,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -415,7 +421,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -423,13 +429,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -442,7 +448,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEntityStoreAssignment"]: @@ -460,10 +468,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEn _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -484,7 +492,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -500,7 +508,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -508,13 +516,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -527,4 +535,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py index cbdaa5a77d2b..7eb1c1c00bd2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py index 6aa5de755b0b..4e9aeed6ee6e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py @@ -46,7 +46,7 @@ from ._security_center_enums import SeverityEnum from ._security_center_enums import SupportedCloudEnum from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py index 4f32f10cb1e8..2c8cfa075004 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -28,7 +28,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -71,7 +71,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -119,10 +119,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -162,15 +162,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2021_07_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -185,7 +185,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -219,7 +219,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 @@ -296,8 +296,8 @@ def __init__( description: Optional[str] = None, remediation_description: Optional[str] = None, assessment_key: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword compressed_query: GZip encoded KQL query representing the assessment automation results required. @@ -392,8 +392,8 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, remediation_description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword compressed_query: Base 64 encoded KQL query representing the assessment automation results required. @@ -445,7 +445,7 @@ class CustomAssessmentAutomationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -492,7 +492,9 @@ class CustomEntityStoreAssignment(Resource): "entity_store_database_link": {"key": "properties.entityStoreDatabaseLink", "type": "str"}, } - def __init__(self, *, principal: Optional[str] = None, entity_store_database_link: Optional[str] = None, **kwargs): + def __init__( + self, *, principal: Optional[str] = None, entity_store_database_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword principal: The principal assigned with entity store. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. @@ -518,7 +520,7 @@ class CustomEntityStoreAssignmentRequest(_serialization.Model): "principal": {"key": "properties.principal", "type": "str"}, } - def __init__(self, *, principal: Optional[str] = None, **kwargs): + def __init__(self, *, principal: Optional[str] = None, **kwargs: Any) -> None: """ :keyword principal: The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. @@ -549,7 +551,7 @@ class CustomEntityStoreAssignmentsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -613,8 +615,8 @@ def __init__( kubernetes_scuba_reader: Optional["_models.DefenderForContainersAwsOfferingKubernetesScubaReader"] = None, cloud_watch_to_kinesis: Optional["_models.DefenderForContainersAwsOfferingCloudWatchToKinesis"] = None, kinesis_to_s3: Optional["_models.DefenderForContainersAwsOfferingKinesisToS3"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -630,7 +632,7 @@ def __init__( ~azure.mgmt.security.v2021_07_01_preview.models.DefenderForContainersAwsOfferingKinesisToS3 """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -648,7 +650,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -668,7 +670,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -688,7 +690,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -708,7 +710,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -761,8 +763,8 @@ def __init__( *, defender_for_servers: Optional["_models.DefenderForServersAwsOfferingDefenderForServers"] = None, arc_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingArcAutoProvisioning"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -772,7 +774,7 @@ def __init__( ~azure.mgmt.security.v2021_07_01_preview.models.DefenderForServersAwsOfferingArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning @@ -803,8 +805,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -841,8 +843,8 @@ def __init__( expiry_date: Optional[str] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: str @@ -868,7 +870,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -898,7 +900,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 @@ -917,7 +919,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -963,15 +965,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2021_07_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -986,7 +988,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1006,7 +1008,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1026,7 +1028,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1080,8 +1082,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1175,8 +1177,8 @@ def __init__( cloud_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, organizational_data: Optional["_models.SecurityConnectorPropertiesOrganizationalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -1239,8 +1241,8 @@ def __init__( parent_hierarchy_id: Optional[str] = None, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organization_membership_type: The multi cloud account's membership type in the organization. Known values are: "Member" and "Organization". @@ -1286,7 +1288,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2021_07_01_preview.models.SecurityConnector] @@ -1334,8 +1336,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py index f8be4db79c2f..395581c73e89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py @@ -11,7 +11,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py index 69b42c942dcd..8932ee8d1189 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,10 +86,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,9 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +214,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -274,10 +274,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -289,9 +289,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -308,7 +308,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @overload def create( @@ -414,11 +416,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -441,9 +443,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,11 +462,13 @@ def create( deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -495,10 +499,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -510,9 +514,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -525,7 +529,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" + } @distributed_trace def list_by_resource_group( @@ -548,10 +554,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -573,7 +579,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -589,7 +595,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -597,13 +603,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -616,7 +622,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessmentAutomation"]: @@ -634,10 +642,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessm _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] + ) + cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -658,7 +666,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -674,7 +682,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -682,13 +690,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomAssessmentAutomationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -701,4 +709,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py index e1ec5f2bdfaf..d79a05d1304a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,10 +86,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,9 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +214,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,10 +275,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -290,9 +290,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -309,7 +309,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @overload def create( @@ -417,11 +419,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -446,9 +448,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,11 +467,13 @@ def create( deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -501,10 +505,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -516,9 +520,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -531,7 +535,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" + } @distributed_trace def list_by_resource_group( @@ -554,10 +560,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -579,7 +585,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -595,7 +601,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -603,13 +609,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -622,7 +628,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityStoreAssignment"]: @@ -640,10 +648,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] + ) + cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -664,7 +672,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -680,7 +688,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -688,13 +696,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomEntityStoreAssignmentsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -707,4 +715,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py index ad867e4287d4..11ba72e8c088 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-07-01-preview") - ) # type: Literal["2021-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py index 9c10b6b87859..543fbef3c8f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] + api_version: Literal["2021-10-01-preview"] = kwargs.pop("api_version", "2021-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json index 99191c265762..9c0620f4c7cc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py index fd10b637870a..e289961108de 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import MdeOnboardingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -77,15 +77,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py index bf874fb09566..50bafc8fc86f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] + api_version: Literal["2021-10-01-preview"] = kwargs.pop("api_version", "2021-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py index 7d42b3093fde..4e49f4f2382c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import MdeOnboardingsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py index 1c4389328fa3..cf82df5f135a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._mde_onboardings_operations import MdeOnboardingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py index 5ade8af29984..aaf59e91077d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py @@ -75,10 +75,10 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] + ) + cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -88,9 +88,9 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,7 +107,7 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} @distributed_trace_async async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: @@ -129,10 +129,10 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] + ) + cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -142,9 +142,9 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -161,4 +161,4 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py index b94357acce61..cb8c7cea8637 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/__init__.py @@ -12,7 +12,7 @@ from ._models_py3 import MdeOnboardingDataList from ._models_py3 import Resource from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py index f6f240ff2eb8..b54da6ab16d9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class CloudErrorBody(_serialization.Model): """The error detail. @@ -46,7 +50,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -77,7 +81,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 @@ -109,7 +113,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 @@ -155,8 +159,8 @@ def __init__( *, onboarding_package_windows: Optional[bytes] = None, onboarding_package_linux: Optional[bytes] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword onboarding_package_windows: The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension. @@ -182,7 +186,7 @@ class MdeOnboardingDataList(_serialization.Model): "value": {"key": "value", "type": "[MdeOnboardingData]"}, } - def __init__(self, *, value: Optional[List["_models.MdeOnboardingData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.MdeOnboardingData"]] = None, **kwargs: Any) -> None: """ :keyword value: List of the resources of the configuration or data needed to onboard the machine to MDE. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py index 1c4389328fa3..cf82df5f135a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._mde_onboardings_operations import MdeOnboardingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py index 537642b6028f..089a030d543e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py @@ -43,9 +43,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,9 +71,9 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,10 +136,10 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] + ) + cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -149,9 +149,9 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -168,7 +168,7 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings"} @distributed_trace def get(self, **kwargs: Any) -> _models.MdeOnboardingData: @@ -190,10 +190,10 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-10-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2021-10-01-preview") - ) # type: Literal["2021-10-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] + ) + cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -203,9 +203,9 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,4 +222,4 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py index f82e49827e0f..2584275a45a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", "2022-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json index d019af3e33e5..f30c7c644cbe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py index 7715a7f00326..8dc38cabba2f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -78,15 +78,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py index 2959d8611ba3..32a9bf18a2df 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", "2022-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py index d10128e19d60..b84b6cadf269 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import AlertsOperations @@ -50,7 +50,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py index 5322d47bdfc7..9e25c75e93da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py @@ -88,8 +88,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -170,8 +170,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -193,7 +193,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -209,7 +209,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -217,13 +217,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -236,7 +236,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -254,8 +256,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -277,7 +279,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -293,7 +295,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -301,13 +303,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -320,7 +322,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -343,8 +347,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -367,7 +371,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -383,7 +387,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -391,13 +395,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,7 +414,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace_async async def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -437,8 +443,8 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -450,9 +456,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -469,7 +475,9 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def get_resource_group_level( @@ -501,8 +509,8 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( resource_group_name=resource_group_name, @@ -515,9 +523,9 @@ async def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -534,7 +542,9 @@ async def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace_async async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -563,8 +573,8 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -576,9 +586,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -591,7 +601,9 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -620,8 +632,8 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -633,9 +645,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,7 +660,9 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -677,8 +691,8 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -690,9 +704,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -705,7 +719,9 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_subscription_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -734,8 +750,8 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( asc_location=asc_location, @@ -747,9 +763,9 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -762,7 +778,9 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_subscription_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } @distributed_trace_async async def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -794,8 +812,8 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( resource_group_name=resource_group_name, @@ -808,9 +826,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -823,7 +841,9 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace_async async def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -855,8 +875,8 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( resource_group_name=resource_group_name, @@ -869,9 +889,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -884,7 +904,9 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace_async async def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -916,8 +938,8 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( resource_group_name=resource_group_name, @@ -930,9 +952,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -945,7 +967,9 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace_async async def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -977,8 +1001,8 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( resource_group_name=resource_group_name, @@ -991,9 +1015,9 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1006,7 +1030,9 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_resource_group_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } async def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1025,9 +1051,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1049,9 +1075,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1064,7 +1090,9 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload async def begin_simulate( @@ -1165,12 +1193,12 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1189,10 +1217,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1204,6 +1232,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py index 5ecc2f93a8b7..21ba3cd6f9a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/__init__.py @@ -27,7 +27,7 @@ from ._security_center_enums import KindEnum from ._security_center_enums import ResourceIdentifierType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py index d06450ef6ea1..1b29705baf4b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py @@ -48,7 +48,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 @@ -210,8 +210,8 @@ def __init__( # pylint: disable=too-many-locals *, extended_properties: Optional[Dict[str, str]] = None, supporting_evidence: Optional["_models.AlertPropertiesSupportingEvidence"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword extended_properties: Custom properties for the alert. :paramtype extended_properties: dict[str, str] @@ -271,7 +271,7 @@ class AlertEntity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -302,7 +302,7 @@ class AlertList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Alert"]] = None, **kwargs: Any) -> None: """ :keyword value: describes security alert properties. :paramtype value: list[~azure.mgmt.security.v2022_01_01.models.Alert] @@ -333,7 +333,7 @@ class AlertPropertiesSupportingEvidence(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -370,7 +370,7 @@ class AlertSimulatorRequestProperties(_serialization.Model): _subtype_map = {"kind": {"Bundles": "AlertSimulatorBundlesRequestProperties"}} - def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs): + def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -378,7 +378,7 @@ def __init__(self, *, additional_properties: Optional[Dict[str, Any]] = None, ** """ super().__init__(**kwargs) self.additional_properties = additional_properties - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSimulatorBundlesRequestProperties(AlertSimulatorRequestProperties): @@ -410,8 +410,8 @@ def __init__( *, additional_properties: Optional[Dict[str, Any]] = None, bundles: Optional[List[Union[str, "_models.BundleType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -420,7 +420,7 @@ def __init__( :paramtype bundles: list[str or ~azure.mgmt.security.v2022_01_01.models.BundleType] """ super().__init__(additional_properties=additional_properties, **kwargs) - self.kind = "Bundles" # type: str + self.kind: str = "Bundles" self.bundles = bundles @@ -435,7 +435,9 @@ class AlertSimulatorRequestBody(_serialization.Model): "properties": {"key": "properties", "type": "AlertSimulatorRequestProperties"}, } - def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.AlertSimulatorRequestProperties"] = None, **kwargs: Any + ) -> None: """ :keyword properties: Alert Simulator request body data. :paramtype properties: ~azure.mgmt.security.v2022_01_01.models.AlertSimulatorRequestProperties @@ -445,7 +447,8 @@ def __init__(self, *, properties: Optional["_models.AlertSimulatorRequestPropert class ResourceIdentifier(_serialization.Model): - """A resource identifier for an alert which can be used to direct the alert to the right product exposure group (tenant, workspace, subscription etc.). + """A resource identifier for an alert which can be used to direct the alert to the right product + exposure group (tenant, workspace, subscription etc.). You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureResourceIdentifier, LogAnalyticsIdentifier @@ -467,10 +470,10 @@ class ResourceIdentifier(_serialization.Model): _subtype_map = {"type": {"AzureResource": "AzureResourceIdentifier", "LogAnalytics": "LogAnalyticsIdentifier"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AzureResourceIdentifier(ResourceIdentifier): @@ -497,10 +500,10 @@ class AzureResourceIdentifier(ResourceIdentifier): "azure_resource_id": {"key": "azureResourceId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "AzureResource" # type: str + self.type: str = "AzureResource" self.azure_resource_id = None @@ -537,7 +540,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -568,7 +571,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 @@ -617,10 +620,10 @@ class LogAnalyticsIdentifier(ResourceIdentifier): "agent_id": {"key": "agentId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "LogAnalytics" # type: str + self.type: str = "LogAnalytics" self.workspace_id = None self.workspace_subscription_id = None self.workspace_resource_group = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py index cc9cbc0e1cc0..f4110fe68b30 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_security_center_enums.py @@ -15,27 +15,27 @@ class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. """ - #: Informational INFORMATIONAL = "Informational" - #: Low + """Informational""" LOW = "Low" - #: Medium + """Low""" MEDIUM = "Medium" - #: High + """Medium""" HIGH = "High" + """High""" class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The life cycle status of the alert.""" - #: An alert which doesn't specify a value is assigned the status 'Active' ACTIVE = "Active" - #: An alert which is in handling state + """An alert which doesn't specify a value is assigned the status 'Active'""" IN_PROGRESS = "InProgress" - #: Alert closed after handling + """An alert which is in handling state""" RESOLVED = "Resolved" - #: Alert dismissed as false positive + """Alert closed after handling""" DISMISSED = "Dismissed" + """Alert dismissed as false positive""" class BundleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,65 +57,65 @@ class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): of Azure Security Center's supported kill chain intents. """ - #: Unknown UNKNOWN = "Unknown" - #: PreAttack could be either an attempt to access a certain resource regardless of a malicious + """Unknown""" + PRE_ATTACK = "PreAttack" + """PreAttack could be either an attempt to access a certain resource regardless of a malicious #: intent, or a failed attempt to gain access to a target system to gather information prior to #: exploitation. This step is usually detected as an attempt, originating from outside the #: network, to scan the target system and find a way in. Further details on the PreAttack stage - #: can be read in `MITRE Pre-Att&ck matrix `_. - PRE_ATTACK = "PreAttack" - #: InitialAccess is the stage where an attacker manages to get foothold on the attacked resource. + #: can be read in `MITRE Pre-Att&ck matrix `_.""" INITIAL_ACCESS = "InitialAccess" - #: Persistence is any access, action, or configuration change to a system that gives a threat - #: actor a persistent presence on that system. + """InitialAccess is the stage where an attacker manages to get foothold on the attacked resource.""" PERSISTENCE = "Persistence" - #: Privilege escalation is the result of actions that allow an adversary to obtain a higher level - #: of permissions on a system or network. + """Persistence is any access, action, or configuration change to a system that gives a threat + #: actor a persistent presence on that system.""" PRIVILEGE_ESCALATION = "PrivilegeEscalation" - #: Defense evasion consists of techniques an adversary may use to evade detection or avoid other - #: defenses. + """Privilege escalation is the result of actions that allow an adversary to obtain a higher level + #: of permissions on a system or network.""" DEFENSE_EVASION = "DefenseEvasion" - #: Credential access represents techniques resulting in access to or control over system, domain, - #: or service credentials that are used within an enterprise environment. + """Defense evasion consists of techniques an adversary may use to evade detection or avoid other + #: defenses.""" CREDENTIAL_ACCESS = "CredentialAccess" - #: Discovery consists of techniques that allow the adversary to gain knowledge about the system - #: and internal network. + """Credential access represents techniques resulting in access to or control over system, domain, + #: or service credentials that are used within an enterprise environment.""" DISCOVERY = "Discovery" - #: Lateral movement consists of techniques that enable an adversary to access and control remote - #: systems on a network and could, but does not necessarily, include execution of tools on remote - #: systems. + """Discovery consists of techniques that allow the adversary to gain knowledge about the system + #: and internal network.""" LATERAL_MOVEMENT = "LateralMovement" - #: The execution tactic represents techniques that result in execution of adversary-controlled - #: code on a local or remote system. + """Lateral movement consists of techniques that enable an adversary to access and control remote + #: systems on a network and could, but does not necessarily, include execution of tools on remote + #: systems.""" EXECUTION = "Execution" - #: Collection consists of techniques used to identify and gather information, such as sensitive - #: files, from a target network prior to exfiltration. + """The execution tactic represents techniques that result in execution of adversary-controlled + #: code on a local or remote system.""" COLLECTION = "Collection" - #: Exfiltration refers to techniques and attributes that result or aid in the adversary removing - #: files and information from a target network. + """Collection consists of techniques used to identify and gather information, such as sensitive + #: files, from a target network prior to exfiltration.""" EXFILTRATION = "Exfiltration" - #: The command and control tactic represents how adversaries communicate with systems under their - #: control within a target network. + """Exfiltration refers to techniques and attributes that result or aid in the adversary removing + #: files and information from a target network.""" COMMAND_AND_CONTROL = "CommandAndControl" - #: Impact events primarily try to directly reduce the availability or integrity of a system, - #: service, or network; including manipulation of data to impact a business or operational - #: process. + """The command and control tactic represents how adversaries communicate with systems under their + #: control within a target network.""" IMPACT = "Impact" - #: Probing could be either an attempt to access a certain resource regardless of a malicious - #: intent, or a failed attempt to gain access to a target system to gather information prior to - #: exploitation. + """Impact events primarily try to directly reduce the availability or integrity of a system, + #: service, or network; including manipulation of data to impact a business or operational + #: process.""" PROBING = "Probing" - #: Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. - #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc. + """Probing could be either an attempt to access a certain resource regardless of a malicious + #: intent, or a failed attempt to gain access to a target system to gather information prior to + #: exploitation.""" EXPLOITATION = "Exploitation" + """Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. + #: This stage is relevant for compute hosts and resources such as user accounts, certificates etc.""" class KindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of alert simulation.""" - #: Simulate alerts according to bundles BUNDLES = "Bundles" + """Simulate alerts according to bundles""" class ResourceIdentifierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py index 522898d37fc6..b3a334939bbd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._alerts_operations import AlertsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py index 8b4e64307f33..6e86b865bc48 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py @@ -47,7 +47,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,7 @@ def build_get_resource_group_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,7 +258,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +291,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -341,7 +341,7 @@ def build_update_subscription_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -357,7 +357,7 @@ def build_update_subscription_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -374,7 +374,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +393,7 @@ def build_update_resource_group_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -410,7 +410,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -429,7 +429,7 @@ def build_update_resource_group_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -446,7 +446,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +465,7 @@ def build_update_resource_group_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -482,7 +482,7 @@ def build_update_resource_group_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -501,7 +501,7 @@ def build_update_resource_group_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -516,8 +516,8 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -532,7 +532,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -576,8 +576,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -598,7 +598,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -614,7 +614,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -622,13 +622,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -641,7 +641,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -658,8 +658,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -681,7 +681,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -697,7 +697,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -705,13 +705,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -724,7 +724,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" + } @distributed_trace def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -742,8 +744,8 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -765,7 +767,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -781,7 +783,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -789,13 +791,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -808,7 +810,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_subscription_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_subscription_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def list_resource_group_level_by_region( @@ -831,8 +835,8 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -855,7 +859,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -871,7 +875,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -879,13 +883,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -898,7 +902,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_resource_group_level_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts"} # type: ignore + list_resource_group_level_by_region.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" + } @distributed_trace def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: Any) -> _models.Alert: @@ -925,8 +931,8 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( asc_location=asc_location, @@ -938,9 +944,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -957,7 +963,9 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A return deserialized - get_subscription_level.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_subscription_level.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def get_resource_group_level( @@ -989,8 +997,8 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( resource_group_name=resource_group_name, @@ -1003,9 +1011,9 @@ def get_resource_group_level( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1022,7 +1030,9 @@ def get_resource_group_level( return deserialized - get_resource_group_level.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"} # type: ignore + get_resource_group_level.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" + } @distributed_trace def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1051,8 +1061,8 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( asc_location=asc_location, @@ -1064,9 +1074,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1079,7 +1089,9 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_subscription_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1108,8 +1120,8 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( asc_location=asc_location, @@ -1121,9 +1133,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1136,7 +1148,9 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_subscription_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_subscription_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1165,8 +1179,8 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( asc_location=asc_location, @@ -1178,9 +1192,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1193,7 +1207,9 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_subscription_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_subscription_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -1222,8 +1238,8 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( asc_location=asc_location, @@ -1235,9 +1251,9 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1250,7 +1266,9 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - update_subscription_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_subscription_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } @distributed_trace def update_resource_group_level_state_to_resolve( # pylint: disable=inconsistent-return-statements @@ -1282,8 +1300,8 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( resource_group_name=resource_group_name, @@ -1296,9 +1314,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1311,7 +1329,9 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_resolve.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve"} # type: ignore + update_resource_group_level_state_to_resolve.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" + } @distributed_trace def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsistent-return-statements @@ -1343,8 +1363,8 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( resource_group_name=resource_group_name, @@ -1357,9 +1377,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1372,7 +1392,9 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_dismiss.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss"} # type: ignore + update_resource_group_level_state_to_dismiss.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" + } @distributed_trace def update_resource_group_level_state_to_activate( # pylint: disable=inconsistent-return-statements @@ -1404,8 +1426,8 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( resource_group_name=resource_group_name, @@ -1418,9 +1440,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1433,7 +1455,9 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_activate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate"} # type: ignore + update_resource_group_level_state_to_activate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" + } @distributed_trace def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsistent-return-statements @@ -1465,8 +1489,8 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( resource_group_name=resource_group_name, @@ -1479,9 +1503,9 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1494,7 +1518,9 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) - update_resource_group_level_state_to_in_progress.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress"} # type: ignore + update_resource_group_level_state_to_in_progress.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + } def _simulate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1513,9 +1539,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1537,9 +1563,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1552,7 +1578,9 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _simulate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + _simulate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } @overload def begin_simulate( @@ -1653,12 +1681,12 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._simulate_initial( # type: ignore asc_location=asc_location, @@ -1677,9 +1705,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1691,6 +1719,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_simulate.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate"} # type: ignore + begin_simulate.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py index d57df2945327..5c46ff4bf08c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py @@ -33,33 +33,25 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-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: + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json index 557420da04a7..24cb0f4dd520 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json @@ -19,13 +19,8 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -34,36 +29,33 @@ "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true } }, "constant": { }, - "call": "credential, subscription_id", + "call": "credential", "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +63,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } @@ -97,12 +92,7 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "governance_rule": "GovernanceRuleOperations", "governance_rules": "GovernanceRulesOperations", - "security_connector_governance_rule": "SecurityConnectorGovernanceRuleOperations", - "security_connector_governance_rules": "SecurityConnectorGovernanceRulesOperations", - "subscription_governance_rules_execute_status": "SubscriptionGovernanceRulesExecuteStatusOperations", - "security_connector_governance_rules_execute_status": "SecurityConnectorGovernanceRulesExecuteStatusOperations", "governance_assignments": "GovernanceAssignmentsOperations" } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py index a12a5f9f4461..77ca17937e6c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py @@ -12,55 +12,27 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - GovernanceAssignmentsOperations, - GovernanceRuleOperations, - GovernanceRulesOperations, - SecurityConnectorGovernanceRuleOperations, - SecurityConnectorGovernanceRulesExecuteStatusOperations, - SecurityConnectorGovernanceRulesOperations, - SubscriptionGovernanceRulesExecuteStatusOperations, -) +from .operations import GovernanceAssignmentsOperations, GovernanceRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar governance_rule: GovernanceRuleOperations operations - :vartype governance_rule: - azure.mgmt.security.v2022_01_01_preview.operations.GovernanceRuleOperations :ivar governance_rules: GovernanceRulesOperations operations :vartype governance_rules: azure.mgmt.security.v2022_01_01_preview.operations.GovernanceRulesOperations - :ivar security_connector_governance_rule: SecurityConnectorGovernanceRuleOperations operations - :vartype security_connector_governance_rule: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRuleOperations - :ivar security_connector_governance_rules: SecurityConnectorGovernanceRulesOperations - operations - :vartype security_connector_governance_rules: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRulesOperations - :ivar subscription_governance_rules_execute_status: - SubscriptionGovernanceRulesExecuteStatusOperations operations - :vartype subscription_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.operations.SubscriptionGovernanceRulesExecuteStatusOperations - :ivar security_connector_governance_rules_execute_status: - SecurityConnectorGovernanceRulesExecuteStatusOperations operations - :vartype security_connector_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.operations.SecurityConnectorGovernanceRulesExecuteStatusOperations :ivar governance_assignments: GovernanceAssignmentsOperations operations :vartype governance_assignments: azure.mgmt.security.v2022_01_01_preview.operations.GovernanceAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :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-01-01-preview". Note that overriding @@ -71,37 +43,18 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too- """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.governance_rule = GovernanceRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.governance_rules = GovernanceRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_connector_governance_rule = SecurityConnectorGovernanceRuleOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules = SecurityConnectorGovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_governance_rules_execute_status = SubscriptionGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules_execute_status = ( - SecurityConnectorGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - ) self.governance_assignments = GovernanceAssignmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -128,15 +81,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py index b57abce4011b..c202d941d402 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py @@ -33,24 +33,19 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01-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: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] + api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py index e2595715763a..d516c1e1f332 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py @@ -12,55 +12,27 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - GovernanceAssignmentsOperations, - GovernanceRuleOperations, - GovernanceRulesOperations, - SecurityConnectorGovernanceRuleOperations, - SecurityConnectorGovernanceRulesExecuteStatusOperations, - SecurityConnectorGovernanceRulesOperations, - SubscriptionGovernanceRulesExecuteStatusOperations, -) +from .operations import GovernanceAssignmentsOperations, GovernanceRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar governance_rule: GovernanceRuleOperations operations - :vartype governance_rule: - azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceRuleOperations :ivar governance_rules: GovernanceRulesOperations operations :vartype governance_rules: azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceRulesOperations - :ivar security_connector_governance_rule: SecurityConnectorGovernanceRuleOperations operations - :vartype security_connector_governance_rule: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRuleOperations - :ivar security_connector_governance_rules: SecurityConnectorGovernanceRulesOperations - operations - :vartype security_connector_governance_rules: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRulesOperations - :ivar subscription_governance_rules_execute_status: - SubscriptionGovernanceRulesExecuteStatusOperations operations - :vartype subscription_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SubscriptionGovernanceRulesExecuteStatusOperations - :ivar security_connector_governance_rules_execute_status: - SecurityConnectorGovernanceRulesExecuteStatusOperations operations - :vartype security_connector_governance_rules_execute_status: - azure.mgmt.security.v2022_01_01_preview.aio.operations.SecurityConnectorGovernanceRulesExecuteStatusOperations :ivar governance_assignments: GovernanceAssignmentsOperations operations :vartype governance_assignments: azure.mgmt.security.v2022_01_01_preview.aio.operations.GovernanceAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :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-01-01-preview". Note that overriding @@ -71,37 +43,18 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too- """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = SecurityCenterConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.governance_rule = GovernanceRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.governance_rules = GovernanceRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_connector_governance_rule = SecurityConnectorGovernanceRuleOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules = SecurityConnectorGovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_governance_rules_execute_status = SubscriptionGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.security_connector_governance_rules_execute_status = ( - SecurityConnectorGovernanceRulesExecuteStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - ) self.governance_assignments = GovernanceAssignmentsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py index 504e37b2c881..860a6a4ae0a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/__init__.py @@ -6,27 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._governance_rule_operations import GovernanceRuleOperations from ._governance_rules_operations import GovernanceRulesOperations -from ._security_connector_governance_rule_operations import SecurityConnectorGovernanceRuleOperations -from ._security_connector_governance_rules_operations import SecurityConnectorGovernanceRulesOperations -from ._subscription_governance_rules_execute_status_operations import SubscriptionGovernanceRulesExecuteStatusOperations -from ._security_connector_governance_rules_execute_status_operations import ( - SecurityConnectorGovernanceRulesExecuteStatusOperations, -) from ._governance_assignments_operations import GovernanceAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "GovernanceRuleOperations", "GovernanceRulesOperations", - "SecurityConnectorGovernanceRuleOperations", - "SecurityConnectorGovernanceRulesOperations", - "SubscriptionGovernanceRulesExecuteStatusOperations", - "SecurityConnectorGovernanceRulesExecuteStatusOperations", "GovernanceAssignmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py index 7be4f81e6edc..b07d5823599a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py @@ -65,13 +65,14 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceAssignment"]: - """Get security governanceAssignments on all your resources inside a scope. + """Get governance assignments on all of your resources inside a scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GovernanceAssignment or the result of @@ -83,10 +84,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] + ) + cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +125,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GovernanceAssignmentsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,7 +152,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} @distributed_trace_async async def get( @@ -159,14 +160,15 @@ async def get( ) -> _models.GovernanceAssignment: """Get a specific governanceAssignment for the requested scope by AssignmentKey. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GovernanceAssignment or the result of cls(response) @@ -184,10 +186,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -199,9 +201,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,7 +220,9 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @overload async def create_or_update( @@ -231,18 +235,19 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -265,18 +270,19 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -296,19 +302,20 @@ async def create_or_update( governance_assignment: Union[_models.GovernanceAssignment, IO], **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Is either a model - type or a IO type. Required. + :param governance_assignment: Governance assignment over a subscription scope. Is either a + model type or a IO type. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -330,11 +337,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -357,9 +364,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,11 +383,13 @@ async def create_or_update( deserialized = self._deserialize("GovernanceAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -388,14 +397,15 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a GovernanceAssignment over a given scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -413,10 +423,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -428,9 +438,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,4 +453,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py deleted file mode 100644 index 2927ce84c770..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py +++ /dev/null @@ -1,140 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._governance_rule_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a subscription level scope. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py index d0f4a162976f..1898b5aa9a87 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py @@ -7,8 +7,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -21,6 +23,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,9 +34,10 @@ from ...operations._governance_rules_operations import ( build_create_or_update_request, build_delete_request, + build_execute_request, build_get_request, - build_rule_id_execute_single_security_connector_request, - build_rule_id_execute_single_subscription_request, + build_list_request, + build_operation_results_request, ) if sys.version_info >= (3, 8): @@ -63,11 +67,105 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: + """Get a list of all relevant governance rules over a scope. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GovernanceRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + scope=scope, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GovernanceRuleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules"} + @distributed_trace_async - async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. + async def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: + """Get a specific governance rule for the requested scope by ruleId. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,23 +184,23 @@ async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -119,23 +217,30 @@ async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @overload async def create_or_update( self, + scope: str, rule_id: str, governance_rule: _models.GovernanceRule, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -148,14 +253,20 @@ async def create_or_update( @overload async def create_or_update( - self, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any + self, scope: str, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -168,15 +279,21 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any + self, scope: str, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. + :param governance_rule: Governance rule over a given scope. Is either a model type or a IO + type. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -197,11 +314,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -212,8 +329,8 @@ async def create_or_update( _json = self._serialize.body(governance_rule, "GovernanceRule") request = build_create_or_update_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -223,9 +340,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -242,24 +359,15 @@ async def create_or_update( deserialized = self._deserialize("GovernanceRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + return deserialized # type: ignore - @distributed_trace_async - async def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a GovernanceRule over a given scope. + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, scope: str, rule_id: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -271,189 +379,54 @@ async def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable= _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + cls: ClsType[None] = kwargs.pop("cls", None) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - async def _rule_id_execute_single_subscription_initial( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): - _content = execute_governance_rule_params - else: - if execute_governance_rule_params is not None: - _json = self._serialize.body(execute_governance_rule_params, "ExecuteGovernanceRuleParams") - else: - _json = None - - request = build_rule_id_execute_single_subscription_request( + request = build_delete_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._rule_id_execute_single_subscription_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_subscription_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore - - @overload - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _delete_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @distributed_trace_async - async def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given subscription. + async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -466,23 +439,21 @@ async def begin_rule_id_execute_single_subscription( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._rule_id_execute_single_subscription_initial( # type: ignore + raw_result = await self._delete_initial( # type: ignore + scope=scope, rule_id=rule_id, - execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -495,7 +466,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -507,14 +480,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - async def _rule_id_execute_single_security_connector_initial( # pylint: disable=inconsistent-return-statements + async def _execute_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any @@ -530,11 +502,11 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,23 +519,21 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable else: _json = None - request = build_rule_id_execute_single_security_connector_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + request = build_execute_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._rule_id_execute_single_security_connector_initial.metadata["url"], + template_url=self._execute_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -579,31 +549,31 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_security_connector_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _execute_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} @overload - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -623,28 +593,28 @@ async def begin_rule_id_execute_single_security_connector( """ @overload - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -663,25 +633,25 @@ async def begin_rule_id_execute_single_security_connector( """ @distributed_trace_async - async def begin_rule_id_execute_single_security_connector( + async def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a + :param execute_governance_rule_params: Execute governance rule over a given scope. Is either a model type or a IO type. Default value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO @@ -703,18 +673,17 @@ async def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._rule_id_execute_single_security_connector_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + raw_result = await self._execute_initial( # type: ignore + scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, @@ -731,7 +700,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -743,6 +714,84 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_execute.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} + + @distributed_trace_async + async def operation_results( + self, scope: str, rule_id: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.OperationResultAutoGenerated]: + """Get governance rules long run operation result for the requested scope by ruleId and + operationId. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). + Required. + :type rule_id: str + :param operation_id: The governance rule long running operation unique key. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResultAutoGenerated or None or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.OperationResultAutoGenerated or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) + + request = build_operation_results_request( + scope=scope, + rule_id=rule_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.operation_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized - begin_rule_id_execute_single_security_connector.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py deleted file mode 100644 index b7e5ea958c44..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rule_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a security connector level scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py deleted file mode 100644 index f11ac5a5538a..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rules_execute_status_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _get_initial( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace_async - async def begin_get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py deleted file mode 100644 index 8446d9e5c7d3..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py +++ /dev/null @@ -1,348 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._security_connector_governance_rules_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SecurityConnectorGovernanceRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`security_connector_governance_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: _models.GovernanceRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: 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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: Union[_models.GovernanceRule, IO], - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule 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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(governance_rule, (IO, bytes)): - _content = governance_rule - else: - _json = self._serialize.body(governance_rule, "GovernanceRule") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> None: - """Delete a GovernanceRule over a given scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py deleted file mode 100644 index 792b2aacd816..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,184 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._subscription_governance_rules_execute_status_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SubscriptionGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.aio.SecurityCenter`'s - :attr:`subscription_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace_async - async def begin_get( - self, rule_id: str, operation_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_initial( # type: ignore - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py index 33ca71a193ab..7cecb4ad458c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import Condition from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ExecuteGovernanceRuleParams -from ._models_py3 import ExecuteRuleStatus from ._models_py3 import GovernanceAssignment from ._models_py3 import GovernanceAssignmentAdditionalData from ._models_py3 import GovernanceAssignmentsList @@ -18,7 +17,9 @@ from ._models_py3 import GovernanceRule from ._models_py3 import GovernanceRuleEmailNotification from ._models_py3 import GovernanceRuleList +from ._models_py3 import GovernanceRuleMetadata from ._models_py3 import GovernanceRuleOwnerSource +from ._models_py3 import OperationResultAutoGenerated from ._models_py3 import RemediationEta from ._models_py3 import Resource @@ -26,8 +27,9 @@ from ._security_center_enums import GovernanceRuleOwnerSourceType from ._security_center_enums import GovernanceRuleSourceResourceType from ._security_center_enums import GovernanceRuleType +from ._security_center_enums import OperationResult from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -35,7 +37,6 @@ "Condition", "ErrorAdditionalInfo", "ExecuteGovernanceRuleParams", - "ExecuteRuleStatus", "GovernanceAssignment", "GovernanceAssignmentAdditionalData", "GovernanceAssignmentsList", @@ -43,13 +44,16 @@ "GovernanceRule", "GovernanceRuleEmailNotification", "GovernanceRuleList", + "GovernanceRuleMetadata", "GovernanceRuleOwnerSource", + "OperationResultAutoGenerated", "RemediationEta", "Resource", "GovernanceRuleConditionOperator", "GovernanceRuleOwnerSourceType", "GovernanceRuleSourceResourceType", "GovernanceRuleType", + "OperationResult", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py index 576f80d26382..e20d116571be 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py @@ -58,7 +58,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -92,11 +92,11 @@ class Condition(_serialization.Model): def __init__( self, *, - property: Optional[str] = None, + property: Optional[str] = None, # pylint: disable=redefined-builtin value: Optional[str] = None, operator: Optional[Union[str, "_models.GovernanceRuleConditionOperator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property: The governance rule Condition's Property, e.g. Severity or AssessmentKey, see examples. @@ -136,7 +136,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 @@ -154,7 +154,7 @@ class ExecuteGovernanceRuleParams(_serialization.Model): "override": {"key": "override", "type": "bool"}, } - def __init__(self, *, override: Optional[bool] = None, **kwargs): + def __init__(self, *, override: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword override: Describe if governance rule should be override. :paramtype override: bool @@ -163,29 +163,6 @@ def __init__(self, *, override: Optional[bool] = None, **kwargs): self.override = override -class ExecuteRuleStatus(_serialization.Model): - """Execute status of Security GovernanceRule over a given scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_id: Unique key for the execution of GovernanceRule. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"readonly": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.operation_id = None - - class Resource(_serialization.Model): """Describes an Azure resource. @@ -211,7 +188,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 @@ -220,7 +197,7 @@ def __init__(self, **kwargs): class GovernanceAssignment(Resource): - """Security GovernanceAssignment over a given scope. + """Governance assignment over a given scope. Variables are only populated by the server, and will be ignored when sending a request. @@ -280,8 +257,8 @@ def __init__( is_grace_period: Optional[bool] = None, governance_email_notification: Optional["_models.GovernanceEmailNotification"] = None, additional_data: Optional["_models.GovernanceAssignmentAdditionalData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword owner: The Owner for the governance assignment - e.g. user@contoso.com - see example. :paramtype owner: str @@ -312,15 +289,15 @@ def __init__( class GovernanceAssignmentAdditionalData(_serialization.Model): - """Describe the additional data of GovernanceAssignment - optional. + """Describe the additional data of governance assignment - optional. - :ivar ticket_number: Ticket number associated with this GovernanceAssignment. + :ivar ticket_number: Ticket number associated with this governance assignment. :vartype ticket_number: int - :ivar ticket_link: Ticket link associated with this GovernanceAssignment - for example: + :ivar ticket_link: Ticket link associated with this governance assignment - for example: https://snow.com. :vartype ticket_link: str - :ivar ticket_status: The ticket status associated with this GovernanceAssignment - for example: - Active. + :ivar ticket_status: The ticket status associated with this governance assignment - for + example: Active. :vartype ticket_status: str """ @@ -340,15 +317,15 @@ def __init__( ticket_number: Optional[int] = None, ticket_link: Optional[str] = None, ticket_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword ticket_number: Ticket number associated with this GovernanceAssignment. + :keyword ticket_number: Ticket number associated with this governance assignment. :paramtype ticket_number: int - :keyword ticket_link: Ticket link associated with this GovernanceAssignment - for example: + :keyword ticket_link: Ticket link associated with this governance assignment - for example: https://snow.com. :paramtype ticket_link: str - :keyword ticket_status: The ticket status associated with this GovernanceAssignment - for + :keyword ticket_status: The ticket status associated with this governance assignment - for example: Active. :paramtype ticket_status: str """ @@ -359,7 +336,7 @@ def __init__( class GovernanceAssignmentsList(_serialization.Model): - """Page of a security governance assignments list. + """Page of a governance assignments list. Variables are only populated by the server, and will be ignored when sending a request. @@ -379,7 +356,7 @@ class GovernanceAssignmentsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -405,8 +382,8 @@ def __init__( *, disable_manager_email_notification: Optional[bool] = None, disable_owner_email_notification: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disable_manager_email_notification: Exclude manager from weekly email notification. :paramtype disable_manager_email_notification: bool @@ -419,7 +396,7 @@ def __init__( class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes - """Security GovernanceRule over a given scope. + """Governance rule over a given scope. Variables are only populated by the server, and will be ignored when sending a request. @@ -429,9 +406,11 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar display_name: display name of the governanceRule. + :ivar tenant_id: The tenantId (GUID). + :vartype tenant_id: str + :ivar display_name: Display name of the governance rule. :vartype display_name: str - :ivar description: description of the governanceRule. + :ivar description: Description of the governance rule. :vartype description: str :ivar remediation_timeframe: Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - means 7 days. @@ -439,7 +418,7 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes :ivar is_grace_period: Defines whether there is a grace period on the governance rule. :vartype is_grace_period: bool :ivar rule_priority: The governance rule priority, priority to the lower number. Rules with the - same priority on the same subscription will not be allowed. + same priority on the same scope will not be allowed. :vartype rule_priority: int :ivar is_disabled: Defines whether the rule is active/inactive. :vartype is_disabled: bool @@ -450,9 +429,15 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes Assessments. "Assessments" :vartype source_resource_type: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleSourceResourceType + :ivar excluded_scopes: Excluded scopes, filter out the descendants of the scope (on management + scopes). + :vartype excluded_scopes: list[str] :ivar condition_sets: The governance rule conditionSets - see examples. :vartype condition_sets: list[JSON] - :ivar owner_source: The Owner source for the governance rule - e.g. Manually by + :ivar include_member_scopes: Defines whether the rule is management scope rule (master + connector as a single scope or management scope). + :vartype include_member_scopes: bool + :ivar owner_source: The owner source for the governance rule - e.g. Manually by user@contoso.com - see example. :vartype owner_source: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleOwnerSource @@ -460,12 +445,16 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes states whether to disable notifications for mangers and owners. :vartype governance_email_notification: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleEmailNotification + :ivar metadata: The governance rule metadata. + :vartype metadata: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleMetadata """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "tenant_id": {"readonly": True}, + "remediation_timeframe": {"pattern": r"^[0-9]+\.[0-9]{2}:[0-9]{2}:[0-9]{2}$"}, "rule_priority": {"maximum": 1000, "minimum": 0}, } @@ -473,6 +462,7 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "remediation_timeframe": {"key": "properties.remediationTimeframe", "type": "str"}, @@ -481,12 +471,15 @@ class GovernanceRule(Resource): # pylint: disable=too-many-instance-attributes "is_disabled": {"key": "properties.isDisabled", "type": "bool"}, "rule_type": {"key": "properties.ruleType", "type": "str"}, "source_resource_type": {"key": "properties.sourceResourceType", "type": "str"}, + "excluded_scopes": {"key": "properties.excludedScopes", "type": "[str]"}, "condition_sets": {"key": "properties.conditionSets", "type": "[object]"}, + "include_member_scopes": {"key": "properties.includeMemberScopes", "type": "bool"}, "owner_source": {"key": "properties.ownerSource", "type": "GovernanceRuleOwnerSource"}, "governance_email_notification": { "key": "properties.governanceEmailNotification", "type": "GovernanceRuleEmailNotification", }, + "metadata": {"key": "properties.metadata", "type": "GovernanceRuleMetadata"}, } def __init__( @@ -500,15 +493,18 @@ def __init__( is_disabled: Optional[bool] = None, rule_type: Optional[Union[str, "_models.GovernanceRuleType"]] = None, source_resource_type: Optional[Union[str, "_models.GovernanceRuleSourceResourceType"]] = None, + excluded_scopes: Optional[List[str]] = None, condition_sets: Optional[List[JSON]] = None, + include_member_scopes: Optional[bool] = None, owner_source: Optional["_models.GovernanceRuleOwnerSource"] = None, governance_email_notification: Optional["_models.GovernanceRuleEmailNotification"] = None, - **kwargs - ): + metadata: Optional["_models.GovernanceRuleMetadata"] = None, + **kwargs: Any + ) -> None: """ - :keyword display_name: display name of the governanceRule. + :keyword display_name: Display name of the governance rule. :paramtype display_name: str - :keyword description: description of the governanceRule. + :keyword description: Description of the governance rule. :paramtype description: str :keyword remediation_timeframe: Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - means 7 days. @@ -516,7 +512,7 @@ def __init__( :keyword is_grace_period: Defines whether there is a grace period on the governance rule. :paramtype is_grace_period: bool :keyword rule_priority: The governance rule priority, priority to the lower number. Rules with - the same priority on the same subscription will not be allowed. + the same priority on the same scope will not be allowed. :paramtype rule_priority: int :keyword is_disabled: Defines whether the rule is active/inactive. :paramtype is_disabled: bool @@ -527,9 +523,15 @@ def __init__( Assessments. "Assessments" :paramtype source_resource_type: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleSourceResourceType + :keyword excluded_scopes: Excluded scopes, filter out the descendants of the scope (on + management scopes). + :paramtype excluded_scopes: list[str] :keyword condition_sets: The governance rule conditionSets - see examples. :paramtype condition_sets: list[JSON] - :keyword owner_source: The Owner source for the governance rule - e.g. Manually by + :keyword include_member_scopes: Defines whether the rule is management scope rule (master + connector as a single scope or management scope). + :paramtype include_member_scopes: bool + :keyword owner_source: The owner source for the governance rule - e.g. Manually by user@contoso.com - see example. :paramtype owner_source: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleOwnerSource @@ -537,8 +539,11 @@ def __init__( rule, states whether to disable notifications for mangers and owners. :paramtype governance_email_notification: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleEmailNotification + :keyword metadata: The governance rule metadata. + :paramtype metadata: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleMetadata """ super().__init__(**kwargs) + self.tenant_id = None self.display_name = display_name self.description = description self.remediation_timeframe = remediation_timeframe @@ -547,9 +552,12 @@ def __init__( self.is_disabled = is_disabled self.rule_type = rule_type self.source_resource_type = source_resource_type + self.excluded_scopes = excluded_scopes self.condition_sets = condition_sets + self.include_member_scopes = include_member_scopes self.owner_source = owner_source self.governance_email_notification = governance_email_notification + self.metadata = metadata class GovernanceRuleEmailNotification(_serialization.Model): @@ -572,8 +580,8 @@ def __init__( *, disable_manager_email_notification: Optional[bool] = None, disable_owner_email_notification: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disable_manager_email_notification: Defines whether manager email notifications are disabled. @@ -588,11 +596,11 @@ def __init__( class GovernanceRuleList(_serialization.Model): - """Page of a security governanceRules list. + """Page of a governance rules list. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Collection of governanceRules in this page. + :ivar value: Collection of governance rules in this page. :vartype value: list[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] :ivar next_link: The URI to fetch the next page. :vartype next_link: str @@ -608,13 +616,51 @@ class GovernanceRuleList(_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 GovernanceRuleMetadata(_serialization.Model): + """The governance rule metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: Governance rule Created by object id (GUID). + :vartype created_by: str + :ivar created_on: Governance rule creation date. + :vartype created_on: ~datetime.datetime + :ivar updated_by: Governance rule last updated by object id (GUID). + :vartype updated_by: str + :ivar updated_on: Governance rule last update date. + :vartype updated_on: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_on": {"readonly": True}, + "updated_by": {"readonly": True}, + "updated_on": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "updated_by": {"key": "updatedBy", "type": "str"}, + "updated_on": {"key": "updatedOn", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_on = None + self.updated_by = None + self.updated_on = None + + class GovernanceRuleOwnerSource(_serialization.Model): """Describe the owner source of governance rule. @@ -636,8 +682,8 @@ def __init__( *, type: Optional[Union[str, "_models.GovernanceRuleOwnerSourceType"]] = None, value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The owner type for the governance rule owner source. Known values are: "ByTag" and "Manually". @@ -651,6 +697,30 @@ def __init__( self.value = value +class OperationResultAutoGenerated(_serialization.Model): + """Long run operation status of governance rule over a given scope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the long run operation result of governance rule. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype status: str or ~azure.mgmt.security.v2022_01_01_preview.models.OperationResult + """ + + _validation = { + "status": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + + class RemediationEta(_serialization.Model): """The ETA (estimated time of arrival) for remediation. @@ -672,7 +742,7 @@ class RemediationEta(_serialization.Model): "justification": {"key": "justification", "type": "str"}, } - def __init__(self, *, eta: datetime.datetime, justification: str, **kwargs): + def __init__(self, *, eta: datetime.datetime, justification: str, **kwargs: Any) -> None: """ :keyword eta: ETA for remediation. Required. :paramtype eta: ~datetime.datetime diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py index 997e5a68c329..fea6722b179f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py @@ -15,33 +15,44 @@ class GovernanceRuleConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMe assessments, see examples. """ - #: Checks that the string value of the data defined in Property equals the given value - exact fit EQUALS = "Equals" - #: Checks that the string value of the data defined in Property equals any of the given values - #: (exact fit) + """Checks that the string value of the data defined in Property equals the given value - exact fit""" IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + #: (exact fit)""" class GovernanceRuleOwnerSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The owner type for the governance rule owner source.""" - #: The rule source type defined using resource tag BY_TAG = "ByTag" - #: The rule source type defined manually + """The rule source type defined using resource tag""" MANUALLY = "Manually" + """The rule source type defined manually""" class GovernanceRuleSourceResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The governance rule source, what the rule affects, e.g. Assessments.""" - #: The source of the governance rule is assessments ASSESSMENTS = "Assessments" + """The source of the governance rule is assessments""" class GovernanceRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The rule type of the governance rule, defines the source of the rule e.g. Integrated.""" - #: The source of the rule type definition is integrated INTEGRATED = "Integrated" - #: The source of the rule type definition is ServiceNow + """The source of the rule type definition is integrated""" SERVICE_NOW = "ServiceNow" + """The source of the rule type definition is ServiceNow""" + + +class OperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the long run operation result of governance rule.""" + + SUCCEEDED = "Succeeded" + """The operation succeeded""" + FAILED = "Failed" + """The operation failed""" + CANCELED = "Canceled" + """The operation canceled""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py index 504e37b2c881..860a6a4ae0a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/__init__.py @@ -6,27 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._governance_rule_operations import GovernanceRuleOperations from ._governance_rules_operations import GovernanceRulesOperations -from ._security_connector_governance_rule_operations import SecurityConnectorGovernanceRuleOperations -from ._security_connector_governance_rules_operations import SecurityConnectorGovernanceRulesOperations -from ._subscription_governance_rules_execute_status_operations import SubscriptionGovernanceRulesExecuteStatusOperations -from ._security_connector_governance_rules_execute_status_operations import ( - SecurityConnectorGovernanceRulesExecuteStatusOperations, -) from ._governance_assignments_operations import GovernanceAssignmentsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "GovernanceRuleOperations", "GovernanceRulesOperations", - "SecurityConnectorGovernanceRuleOperations", - "SecurityConnectorGovernanceRulesOperations", - "SubscriptionGovernanceRulesExecuteStatusOperations", - "SecurityConnectorGovernanceRulesExecuteStatusOperations", "GovernanceAssignmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py index b5e0bcae48b5..073e2f214598 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py @@ -45,9 +45,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,11 +55,11 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "template_url", "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments" ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,9 +74,9 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,12 +85,12 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,10 +105,10 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,12 +117,12 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,21 +138,21 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ def build_delete_request(scope: str, assessment_name: str, assignment_key: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", ) # pylint: disable=line-too-long path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,13 +181,14 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_models.GovernanceAssignment"]: - """Get security governanceAssignments on all your resources inside a scope. + """Get governance assignments on all of your resources inside a scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GovernanceAssignment or the result of @@ -199,10 +200,10 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] + ) + cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -224,7 +225,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -240,7 +241,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -248,13 +249,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GovernanceAssignmentsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -267,20 +268,21 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments"} @distributed_trace def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: Any) -> _models.GovernanceAssignment: """Get a specific governanceAssignment for the requested scope by AssignmentKey. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GovernanceAssignment or the result of cls(response) @@ -298,10 +300,10 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -313,9 +315,9 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,7 +334,9 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + get.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @overload def create_or_update( @@ -345,18 +349,19 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -379,18 +384,19 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Required. + :param governance_assignment: Governance assignment over a subscription scope. Required. :type governance_assignment: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -410,19 +416,20 @@ def create_or_update( governance_assignment: Union[_models.GovernanceAssignment, IO], **kwargs: Any ) -> _models.GovernanceAssignment: - """Creates or update a security GovernanceAssignment on the given subscription. + """Creates or updates a governance assignment on the given subscription. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str - :param governance_assignment: GovernanceAssignment over a subscription scope. Is either a model - type or a IO type. Required. + :param governance_assignment: Governance assignment over a subscription scope. Is either a + model type or a IO type. Required. :type governance_assignment: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceAssignment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -444,11 +451,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -471,9 +478,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -490,11 +497,13 @@ def create_or_update( deserialized = self._deserialize("GovernanceAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + create_or_update.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -502,14 +511,15 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a GovernanceAssignment over a given scope. - :param scope: Scope of the query, can be subscription - (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - (/providers/Microsoft.Management/managementGroups/mgName). Required. + :param scope: The scope of the Governance assignments. Valid scopes are: subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. :type scope: str - :param assessment_name: The Assessment Key - Unique key for the assessment type. Required. + :param assessment_name: The Assessment Key - A unique key for the assessment type. Required. :type assessment_name: str - :param assignment_key: The security governance assignment key - the assessment key of the - required governance assignment. Required. + :param assignment_key: The governance assignment key - the assessment key of the required + governance assignment. Required. :type assignment_key: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) @@ -527,10 +537,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -542,9 +552,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -557,4 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"} # type: ignore + delete.metadata = { + "url": "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py deleted file mode 100644 index 79400be6e24d..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py +++ /dev/null @@ -1,171 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a subscription level scope. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py index 3871d0f36948..e50f2733859c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +18,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -41,27 +43,49 @@ _SERIALIZER.client_side_validation = False -def build_get_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, rule_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-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,28 +96,24 @@ def build_get_request(rule_id: str, subscription_id: str, **kwargs: Any) -> Http return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + 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}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,24 +126,20 @@ def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] + ) # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,28 +147,24 @@ def build_delete_request(rule_id: str, subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_rule_id_execute_single_subscription_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_execute_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + 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}/providers/Microsoft.Security/governanceRules/{ruleId}/execute" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute") path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,45 +177,34 @@ def build_rule_id_execute_single_subscription_request(rule_id: str, subscription return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rule_id_execute_single_security_connector_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_operation_results_request(scope: str, rule_id: str, operation_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute", + "template_url", "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + "scope": _SERIALIZER.url("scope", scope, "str"), "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) class GovernanceRulesOperations: @@ -226,10 +227,104 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. + def list(self, scope: str, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: + """Get a list of all relevant governance rules over a scope. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GovernanceRule or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + scope=scope, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GovernanceRuleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules"} + + @distributed_trace + def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: + """Get a specific governance rule for the requested scope by ruleId. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -248,23 +343,23 @@ def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -281,23 +376,30 @@ def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} @overload def create_or_update( self, + scope: str, rule_id: str, governance_rule: _models.GovernanceRule, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -310,14 +412,20 @@ def create_or_update( @overload def create_or_update( - self, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any + self, scope: str, rule_id: str, governance_rule: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. + :param governance_rule: Governance rule over a given scope. Required. :type governance_rule: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -330,15 +438,21 @@ def create_or_update( @distributed_trace def create_or_update( - self, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any + self, scope: str, rule_id: str, governance_rule: Union[_models.GovernanceRule, IO], **kwargs: Any ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given subscription. + """Creates or updates a governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. + :param governance_rule: Governance rule over a given scope. Is either a model type or a IO + type. Required. :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -359,11 +473,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,8 +488,8 @@ def create_or_update( _json = self._serialize.body(governance_rule, "GovernanceRule") request = build_create_or_update_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -385,9 +499,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,24 +518,15 @@ def create_or_update( deserialized = self._deserialize("GovernanceRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore + return deserialized # type: ignore - @distributed_trace - def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a GovernanceRule over a given scope. + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, scope: str, rule_id: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -433,157 +538,54 @@ def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs ) + cls: ClsType[None] = kwargs.pop("cls", None) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - def _rule_id_execute_single_subscription_initial( # pylint: disable=inconsistent-return-statements - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): - _content = execute_governance_rule_params - else: - if execute_governance_rule_params is not None: - _json = self._serialize.body(execute_governance_rule_params, "ExecuteGovernanceRuleParams") - else: - _json = None - - request = build_rule_id_execute_single_subscription_request( + request = build_delete_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._rule_id_execute_single_subscription_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_subscription_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _delete_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - @overload - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. + @distributed_trace + def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Governance rule over a given scope. - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. - :type execute_governance_rule_params: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -596,55 +598,21 @@ def begin_rule_id_execute_single_subscription( :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - - @distributed_trace - def begin_rule_id_execute_single_subscription( - self, - rule_id: str, - execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given subscription. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a - model type or a IO type. Default value is None. - :type execute_governance_rule_params: - ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._rule_id_execute_single_subscription_initial( # type: ignore + raw_result = self._delete_initial( # type: ignore + scope=scope, rule_id=rule_id, - execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -657,7 +625,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -669,14 +639,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_delete.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"} - def _rule_id_execute_single_security_connector_initial( # pylint: disable=inconsistent-return-statements + def _execute_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any @@ -692,11 +661,11 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -709,23 +678,21 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon else: _json = None - request = build_rule_id_execute_single_security_connector_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + request = build_execute_request( + scope=scope, rule_id=rule_id, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._rule_id_execute_single_security_connector_initial.metadata["url"], + template_url=self._execute_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -741,31 +708,31 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, response_headers) - _rule_id_execute_single_security_connector_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + _execute_initial.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} @overload - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[_models.ExecuteGovernanceRuleParams] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -785,28 +752,28 @@ def begin_rule_id_execute_single_security_connector( """ @overload - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Default value - is None. + :param execute_governance_rule_params: Execute governance rule over a given scope. Default + value is None. :type execute_governance_rule_params: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -825,25 +792,25 @@ def begin_rule_id_execute_single_security_connector( """ @distributed_trace - def begin_rule_id_execute_single_security_connector( + def begin_execute( self, - resource_group_name: str, - security_connector_name: str, + scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO]] = None, **kwargs: Any ) -> LROPoller[None]: - """Execute a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. + """Execute a governance rule. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). Required. :type rule_id: str - :param execute_governance_rule_params: GovernanceRule over a subscription scope. Is either a + :param execute_governance_rule_params: Execute governance rule over a given scope. Is either a model type or a IO type. Default value is None. :type execute_governance_rule_params: ~azure.mgmt.security.v2022_01_01_preview.models.ExecuteGovernanceRuleParams or IO @@ -865,18 +832,17 @@ def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-01-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._rule_id_execute_single_security_connector_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, + raw_result = self._execute_initial( # type: ignore + scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, api_version=api_version, @@ -893,7 +859,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -905,6 +873,84 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rule_id_execute_single_security_connector.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} # type: ignore + begin_execute.metadata = {"url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute"} + + @distributed_trace + def operation_results( + self, scope: str, rule_id: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.OperationResultAutoGenerated]: + """Get governance rules long run operation result for the requested scope by ruleId and + operationId. + + :param scope: The scope of the Governance rules. Valid scopes are: management group (format: + 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + 'subscriptions/{subscriptionId}'), or security connector (format: + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + Required. + :type scope: str + :param rule_id: The governance rule key - unique key for the standard governance rule (GUID). + Required. + :type rule_id: str + :param operation_id: The governance rule long running operation unique key. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResultAutoGenerated or None or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.OperationResultAutoGenerated or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-01-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) + cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) + + request = build_operation_results_request( + scope=scope, + rule_id=rule_id, + operation_id=operation_id, + api_version=api_version, + template_url=self.operation_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py deleted file mode 100644 index 3c1dbacd1a65..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py +++ /dev/null @@ -1,189 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, security_connector_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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecurityConnectorGovernanceRuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> Iterable["_models.GovernanceRule"]: - """Get a list of all relevant governanceRules over a security connector level scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GovernanceRule or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GovernanceRuleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py deleted file mode 100644 index 506e10ad39a4..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,242 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - security_connector_name: str, - rule_id: str, - operation_id: 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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecurityConnectorGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _get_initial( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace - def begin_get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, operation_id: str, **kwargs: Any - ) -> LROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_initial( # type: ignore - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py deleted file mode 100644 index 2df8e4d1fa94..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py +++ /dev/null @@ -1,458 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, security_connector_name: str, rule_id: 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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, security_connector_name: str, rule_id: 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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, security_connector_name: str, rule_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -class SecurityConnectorGovernanceRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`security_connector_governance_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> _models.GovernanceRule: - """Get a specific governanceRule for the requested scope by ruleId. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - request = build_get_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: _models.GovernanceRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Required. - :type governance_rule: 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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - security_connector_name: str, - rule_id: str, - governance_rule: Union[_models.GovernanceRule, IO], - **kwargs: Any - ) -> _models.GovernanceRule: - """Creates or update a security GovernanceRule on the given security connector. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param governance_rule: GovernanceRule over a subscription scope. Is either a model type or a - IO type. Required. - :type governance_rule: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule 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: GovernanceRule or the result of cls(response) - :rtype: ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRule - :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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(governance_rule, (IO, bytes)): - _content = governance_rule - else: - _json = self._serialize.body(governance_rule, "GovernanceRule") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, rule_id: str, **kwargs: Any - ) -> None: - """Delete a GovernanceRule over a given scope. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param security_connector_name: The security connector name. Required. - :type security_connector_name: str - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - security_connector_name=security_connector_name, - rule_id=rule_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py deleted file mode 100644 index cc18a6fa6af6..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py +++ /dev/null @@ -1,218 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(rule_id: str, operation_id: 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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SubscriptionGovernanceRulesExecuteStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2022_01_01_preview.SecurityCenter`'s - :attr:`subscription_governance_rules_execute_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> Optional[_models.ExecuteRuleStatus]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] - - request = build_get_request( - rule_id=rule_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _get_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore - - @distributed_trace - def begin_get(self, rule_id: str, operation_id: str, **kwargs: Any) -> LROPoller[_models.ExecuteRuleStatus]: - """Get a specific governanceRule execution status for the requested scope by ruleId and - operationId. - - :param rule_id: The security GovernanceRule key - unique key for the standard GovernanceRule. - Required. - :type rule_id: str - :param operation_id: The security GovernanceRule execution key - unique key for the execution - of GovernanceRule. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ExecuteRuleStatus or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.security.v2022_01_01_preview.models.ExecuteRuleStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) # type: Literal["2022-01-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_initial( # type: ignore - rule_id=rule_id, - operation_id=operation_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ExecuteRuleStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py index 1f9210f091e9..617179e3e3e1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json index 89b310cffc2b..2a7e13032785 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py index 939eccf165e7..9e900c03debf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py index f46270fe370c..9e619b0f90e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py index fab10ae9528a..fe4aa3e864fd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import PricingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py index f7139469b6e8..2bc0d8154788 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -86,9 +86,9 @@ async def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace_async async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -129,8 +129,8 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -141,9 +141,9 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -160,7 +160,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload async def update( @@ -227,9 +227,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -251,9 +251,9 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -270,4 +270,4 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py index a6335e2b1d2d..82e99d49aec6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/__init__.py @@ -14,7 +14,7 @@ from ._security_center_enums import PricingTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py index 93779d1c9a8a..c621e73948f6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_models_py3.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -49,7 +49,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -80,7 +80,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 @@ -112,7 +112,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 @@ -121,7 +121,9 @@ def __init__(self, **kwargs): class Pricing(Resource): - """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. + """Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the + standard tier available with a trial period. The standard tier offers advanced security + capabilities, while the free tier offers basic security features. Variables are only populated by the server, and will be ignored when sending a request. @@ -176,8 +178,8 @@ def __init__( *, pricing_tier: Optional[Union[str, "_models.PricingTier"]] = None, sub_plan: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pricing_tier: The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The @@ -214,7 +216,7 @@ class PricingList(_serialization.Model): "value": {"key": "value", "type": "[Pricing]"}, } - def __init__(self, *, value: List["_models.Pricing"], **kwargs): + def __init__(self, *, value: List["_models.Pricing"], **kwargs: Any) -> None: """ :keyword value: List of pricing configurations. Required. :paramtype value: list[~azure.mgmt.security.v2022_03_01.models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py index 3a3bb1f34505..340d6e87274f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/models/_security_center_enums.py @@ -16,7 +16,7 @@ class PricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): advanced security capabilities, while the free tier offers basic security features. """ - #: Get free Microsoft Defender for Cloud experience with basic security features FREE = "Free" - #: Get the standard Microsoft Defender for Cloud experience with advanced security features + """Get free Microsoft Defender for Cloud experience with basic security features""" STANDARD = "Standard" + """Get the standard Microsoft Defender for Cloud experience with advanced security features""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py index 81b7ce3e1103..3f34d5a48636 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._pricings_operations import PricingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py index ae0053fbc7f8..56720dc894f0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py @@ -43,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,8 +98,8 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +165,8 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -176,9 +176,9 @@ def list(self, **kwargs: Any) -> _models.PricingList: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +195,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings"} @distributed_trace def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: @@ -219,8 +219,8 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( pricing_name=pricing_name, @@ -231,9 +231,9 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -250,7 +250,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} @overload def update( @@ -317,9 +317,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] + api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,9 +341,9 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,4 +360,4 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py index cc031b97ea90..a89bf26be25f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json index 47a3ee3d7feb..e8407f15d8d0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py index 0a472cc8411e..f9e21a8b7346 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -76,15 +76,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py index 74da18d1fbd7..4e3b5f425006 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py index 69a74305392a..eadcd9f859e2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SettingsOperations @@ -48,7 +48,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py index fc65f030d9dd..a510ad04b4b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace_async async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -161,8 +161,8 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -173,9 +173,9 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -192,7 +192,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload async def update( @@ -274,9 +274,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +298,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,4 +317,4 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py index 63e5f8c91733..ce862c57b5f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/__init__.py @@ -17,7 +17,7 @@ from ._security_center_enums import SettingKind from ._security_center_enums import SettingName from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py index 32f113ef85a8..71c2cc833bcb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import Any, List, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class Resource(_serialization.Model): """Describes an Azure resource. @@ -37,7 +41,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 @@ -82,10 +86,10 @@ class Setting(Resource): _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class AlertSyncSettings(Setting): @@ -123,13 +127,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "AlertSyncSettings" # type: str + self.kind: str = "AlertSyncSettings" self.enabled = enabled @@ -166,7 +170,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -211,13 +215,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = "DataExportSettings" # type: str + self.kind: str = "DataExportSettings" self.enabled = enabled @@ -242,7 +246,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 @@ -269,7 +273,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs: Any) -> None: """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2022_05_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py index 0b0925b026d7..1046445c98b6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/__init__.py @@ -9,7 +9,7 @@ from ._settings_operations import SettingsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py index 9bfd1bb6817b..452b6b52cb15 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py @@ -45,7 +45,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,8 +104,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,8 +163,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +185,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +201,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +209,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SettingsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -228,7 +228,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} @distributed_trace def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: @@ -253,8 +253,8 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( setting_name=setting_name, @@ -265,9 +265,9 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -284,7 +284,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} @overload def update( @@ -366,9 +366,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] + api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -390,9 +390,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -409,4 +409,4 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py index 28502606ce6d..d8bc7452ee6d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] + api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json index 8f808801f946..601eac915219 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py index c460ae0e2da1..f0dc865b3eaf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py index 2c12da03e992..736771f1e9a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] + api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py index 2aecef4febdc..e362854e1e16 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py index 3f7a149b2b74..f524441b44ce 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py index 53ad2709ca23..a72e752d54cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/__init__.py @@ -83,7 +83,7 @@ from ._security_center_enums import SubPlan from ._security_center_enums import Type from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py index 7328d7eb9110..29af470f1e98 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py @@ -56,10 +56,10 @@ class EnvironmentData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = None # type: Optional[str] + self.environment_type: Optional[str] = None class AWSEnvironmentData(EnvironmentData): @@ -85,14 +85,14 @@ class AWSEnvironmentData(EnvironmentData): "organizational_data": {"key": "organizationalData", "type": "AwsOrganizationalData"}, } - def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs): + def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs: Any) -> None: """ :keyword organizational_data: The AWS account's organizational data. :paramtype organizational_data: ~azure.mgmt.security.v2022_05_01_preview.models.AwsOrganizationalData """ super().__init__(**kwargs) - self.environment_type = "AwsAccount" # type: str + self.environment_type: str = "AwsAccount" self.organizational_data = organizational_data @@ -125,10 +125,10 @@ class AwsOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class AwsOrganizationalDataMaster(AwsOrganizationalData): @@ -159,8 +159,8 @@ class AwsOrganizationalDataMaster(AwsOrganizationalData): } def __init__( - self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs - ): + self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword stackset_name: If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. @@ -170,7 +170,7 @@ def __init__( :paramtype excluded_account_ids: list[str] """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.stackset_name = stackset_name self.excluded_account_ids = excluded_account_ids @@ -198,14 +198,14 @@ class AwsOrganizationalDataMember(AwsOrganizationalData): "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, } - def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs): + def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. :paramtype parent_hierarchy_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id @@ -228,10 +228,10 @@ class AzureDevOpsScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "AzureDevOpsScope" # type: str + self.environment_type: str = "AzureDevOpsScope" class AzureTrackedResourceLocation(_serialization.Model): @@ -245,7 +245,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -288,7 +288,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -347,10 +347,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -392,15 +392,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_05_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -415,7 +415,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -451,10 +451,10 @@ class CspmMonitorAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAzureDevOps" # type: str + self.offering_type: str = "CspmMonitorAzureDevOps" class CspmMonitorGcpOffering(CloudOffering): @@ -495,15 +495,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorGcpOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_05_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGcp" # type: str + self.offering_type: str = "CspmMonitorGcp" self.native_cloud_connection = native_cloud_connection @@ -527,8 +527,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The GCP workload identity provider id for the offering. :paramtype workload_identity_provider_id: str @@ -568,10 +568,10 @@ class CspmMonitorGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGithub" # type: str + self.offering_type: str = "CspmMonitorGithub" class DefenderFoDatabasesAwsOffering(CloudOffering): @@ -612,15 +612,15 @@ def __init__( self, *, arc_auto_provisioning: Optional["_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: ~azure.mgmt.security.v2022_05_01_preview.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesAws" # type: str + self.offering_type: str = "DefenderForDatabasesAws" self.arc_auto_provisioning = arc_auto_provisioning @@ -654,8 +654,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -695,8 +695,8 @@ def __init__( expiry_date: Optional[datetime.datetime] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: ~datetime.datetime @@ -807,8 +807,8 @@ def __init__( auto_provisioning: Optional[bool] = None, kube_audit_retention_time: Optional[int] = None, scuba_external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -843,7 +843,7 @@ def __init__( :paramtype scuba_external_id: str """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -868,7 +868,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. @@ -889,7 +889,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(_serializ "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -909,7 +909,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(_seri "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -929,7 +929,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. :paramtype cloud_role_arn: str @@ -949,7 +949,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. :paramtype cloud_role_arn: str @@ -970,7 +970,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning resources. @@ -1042,8 +1042,8 @@ def __init__( audit_logs_auto_provisioning_flag: Optional[bool] = None, defender_agent_auto_provisioning_flag: Optional[bool] = None, policy_agent_auto_provisioning_flag: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: @@ -1061,7 +1061,7 @@ def __init__( :paramtype policy_agent_auto_provisioning_flag: bool """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersGcp" # type: str + self.offering_type: str = "DefenderForContainersGcp" self.native_cloud_connection = native_cloud_connection self.data_pipeline_native_cloud_connection = data_pipeline_native_cloud_connection self.audit_logs_auto_provisioning_flag = audit_logs_auto_provisioning_flag @@ -1090,8 +1090,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The data collection service account email address in GCP for this offering. @@ -1125,8 +1125,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1188,8 +1188,8 @@ def __init__( defender_for_databases_arc_auto_provisioning: Optional[ "_models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -1200,7 +1200,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesGcp" # type: str + self.offering_type: str = "DefenderForDatabasesGcp" self.arc_auto_provisioning = arc_auto_provisioning self.defender_for_databases_arc_auto_provisioning = defender_for_databases_arc_auto_provisioning @@ -1228,8 +1228,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1262,8 +1262,8 @@ def __init__( *, client_id: Optional[str] = None, agent_onboarding_service_account_numeric_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: The Azure service principal client id for agent onboarding. :paramtype client_id: str @@ -1296,8 +1296,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1384,8 +1384,8 @@ def __init__( mde_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersAwsOfferingSubPlan"] = None, vm_scanners: Optional["_models.DefenderForServersAwsOfferingVmScanners"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1408,7 +1408,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForServersAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1447,8 +1447,8 @@ def __init__( service_principal_secret_metadata: Optional[ "_models.DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1488,8 +1488,8 @@ def __init__( expiry_date: Optional[str] = None, parameter_store_region: Optional[str] = None, parameter_name_in_store: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword expiry_date: expiration date of service principal secret. :paramtype expiry_date: str @@ -1515,7 +1515,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1538,7 +1538,7 @@ class DefenderForServersAwsOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1561,7 +1561,7 @@ class DefenderForServersAwsOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_05_01_preview.models.SubPlan @@ -1593,8 +1593,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1619,7 +1619,7 @@ class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -1649,8 +1649,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -1686,8 +1686,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1770,8 +1770,8 @@ def __init__( va_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioning"] = None, mde_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersGcpOfferingSubPlan"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1791,7 +1791,7 @@ def __init__( ~azure.mgmt.security.v2022_05_01_preview.models.DefenderForServersGcpOfferingSubPlan """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersGcp" # type: str + self.offering_type: str = "DefenderForServersGcp" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1822,8 +1822,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1856,8 +1856,8 @@ def __init__( *, client_id: Optional[str] = None, agent_onboarding_service_account_numeric_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: The Azure service principal client id for agent onboarding. :paramtype client_id: str @@ -1889,8 +1889,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The workload identity provider id in GCP for this feature. @@ -1918,7 +1918,7 @@ class DefenderForServersGcpOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1941,7 +1941,7 @@ class DefenderForServersGcpOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_05_01_preview.models.SubPlan @@ -1973,8 +1973,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1999,7 +1999,7 @@ class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -2030,7 +2030,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 @@ -2049,7 +2049,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -2088,10 +2088,10 @@ class GcpOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class GcpOrganizationalDataMember(GcpOrganizationalData): @@ -2122,8 +2122,12 @@ class GcpOrganizationalDataMember(GcpOrganizationalData): } def __init__( - self, *, parent_hierarchy_id: Optional[str] = None, management_project_number: Optional[str] = None, **kwargs - ): + self, + *, + parent_hierarchy_id: Optional[str] = None, + management_project_number: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. @@ -2133,7 +2137,7 @@ def __init__( :paramtype management_project_number: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id self.management_project_number = management_project_number @@ -2175,8 +2179,8 @@ def __init__( excluded_project_numbers: Optional[List[str]] = None, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword excluded_project_numbers: If the multi cloud account is of membership type organization, list of accounts excluded from offering. @@ -2189,7 +2193,7 @@ def __init__( :paramtype workload_identity_provider_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.excluded_project_numbers = excluded_project_numbers self.service_account_email_address = service_account_email_address self.workload_identity_provider_id = workload_identity_provider_id @@ -2218,7 +2222,9 @@ class GcpProjectDetails(_serialization.Model): "workload_identity_pool_id": {"key": "workloadIdentityPoolId", "type": "str"}, } - def __init__(self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs): + def __init__( + self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword project_number: The unique GCP Project number. :paramtype project_number: str @@ -2262,8 +2268,8 @@ def __init__( *, organizational_data: Optional["_models.GcpOrganizationalData"] = None, project_details: Optional["_models.GcpProjectDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organizational_data: The Gcp project's organizational data. :paramtype organizational_data: @@ -2272,7 +2278,7 @@ def __init__( :paramtype project_details: ~azure.mgmt.security.v2022_05_01_preview.models.GcpProjectDetails """ super().__init__(**kwargs) - self.environment_type = "GcpProject" # type: str + self.environment_type: str = "GcpProject" self.organizational_data = organizational_data self.project_details = project_details @@ -2296,10 +2302,10 @@ class GithubScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "GithubScope" # type: str + self.environment_type: str = "GithubScope" class InformationProtectionAwsOffering(CloudOffering): @@ -2340,15 +2346,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2022_05_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -2363,7 +2369,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -2383,7 +2389,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -2417,7 +2423,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 @@ -2436,7 +2442,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2490,8 +2496,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2589,8 +2595,8 @@ def __init__( environment_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, environment_data: Optional["_models.EnvironmentData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2644,7 +2650,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2022_05_01_preview.models.SecurityConnector] @@ -2692,8 +2698,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py index dfc75e6d5f8c..ac95629467f3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-05-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-05-01-preview") - ) # type: Literal["2022-05-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py index 19075a8c40b3..98fe9a4d9888 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json index 934d3a1b93c2..5af72eda52ec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py index 4b2867e2c902..466e65cad772 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -62,7 +62,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -97,15 +97,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py index 5caa1ff7da9b..bd02ffa6504e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py index eb0b06d00415..b1a6b1a4bff0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( @@ -63,7 +63,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py index 61c6546366e5..c85f8d56b434 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._security_connector_application_operations import SecurityConnectorApplicationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py index 85dc02912d07..21c2761e9499 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py @@ -82,10 +82,10 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( application_id=application_id, @@ -96,9 +96,9 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,7 +115,7 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} @overload async def create_or_update( @@ -193,11 +193,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -219,9 +219,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -238,11 +238,13 @@ async def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -269,10 +271,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( application_id=application_id, @@ -283,9 +285,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,4 +300,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py index 007fca2dda37..10450d905899 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +110,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py index 9d8b5af8b8ef..08803da8d736 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py @@ -89,10 +89,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -105,9 +105,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,7 +124,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @overload async def create_or_update( @@ -231,11 +233,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,9 +261,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,11 +280,13 @@ async def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -314,10 +318,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -330,9 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,4 +349,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py index 92eaa30a2497..e76ca3618db5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py @@ -77,10 +77,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,4 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py index 686374128fc6..0958c7d80773 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/__init__.py @@ -16,7 +16,7 @@ from ._security_center_enums import ApplicationConditionOperator from ._security_center_enums import ApplicationSourceResourceType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py index 335ade6e169d..6f7d99436f2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py @@ -48,7 +48,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 @@ -102,8 +102,8 @@ def __init__( description: Optional[str] = None, source_resource_type: Optional[Union[str, "_models.ApplicationSourceResourceType"]] = None, condition_sets: Optional[List[JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: display name of the application. :paramtype display_name: str @@ -145,11 +145,11 @@ class ApplicationCondition(_serialization.Model): def __init__( self, *, - property: Optional[str] = None, + property: Optional[str] = None, # pylint: disable=redefined-builtin value: Optional[str] = None, operator: Optional[Union[str, "_models.ApplicationConditionOperator"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property: The application Condition's Property, e.g. ID, see examples. :paramtype property: str @@ -188,7 +188,7 @@ class ApplicationsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -229,7 +229,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -260,7 +260,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py index 5b64e0a4d2a4..9c0d24557f3b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py @@ -15,17 +15,17 @@ class ApplicationConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta) IDs, see examples. """ - #: Checks that the string value of the data defined in Property contains the given value CONTAINS = "Contains" - #: Checks that the string value of the data defined in Property equals the given value + """Checks that the string value of the data defined in Property contains the given value""" EQUALS = "Equals" - #: Checks that the string value of the data defined in Property equals any of the given values - #: (exact fit) + """Checks that the string value of the data defined in Property equals the given value""" IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + #: (exact fit)""" class ApplicationSourceResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The application source, what it affects, e.g. Assessments.""" - #: The source of the application is assessments ASSESSMENTS = "Assessments" + """The source of the application is assessments""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py index 61c6546366e5..c85f8d56b434 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/__init__.py @@ -12,7 +12,7 @@ from ._security_connector_application_operations import SecurityConnectorApplicationOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py index e84db16005c4..08769c25f635 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py @@ -43,9 +43,9 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,10 +74,10 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +107,9 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** def build_delete_request(application_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" @@ -121,7 +121,7 @@ def build_delete_request(application_id: str, subscription_id: str, **kwargs: An "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( application_id=application_id, @@ -185,9 +185,9 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +204,7 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} @overload def create_or_update( @@ -282,11 +282,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -308,9 +308,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -327,11 +327,13 @@ def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -356,10 +358,10 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( application_id=application_id, @@ -370,9 +372,9 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,4 +387,6 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py index f8006290b71d..e8b5eb53e499 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,10 +101,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -125,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -141,7 +141,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -149,13 +149,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -168,4 +168,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications"} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py index 291bb2803f03..10f049276317 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py @@ -45,9 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_get_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,10 +83,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +105,7 @@ def build_create_or_update_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,9 +123,9 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) # Construct URL _url = kwargs.pop( "template_url", @@ -142,7 +142,7 @@ def build_delete_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,10 +199,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -215,9 +215,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -234,7 +234,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @overload def create_or_update( @@ -341,11 +343,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -369,9 +371,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -388,11 +390,13 @@ def create_or_update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -424,10 +428,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -440,9 +444,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -455,4 +459,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py index 858b1ef83b94..354fb4dc565d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py @@ -47,9 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,10 +117,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-07-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] + ) + cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -143,7 +143,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -159,7 +159,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -167,13 +167,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,4 +186,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py index b4893ccdf609..e95a015ca6b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py index f5c6e9e2a86e..d05f1ca002f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-01-preview"] + api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json index e9aceb5f52df..0d09b3295d0b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json @@ -19,13 +19,15 @@ "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true + "required": true, + "method_location": "positional" }, "subscription_id": { "signature": "subscription_id: str,", "description": "Azure subscription ID. Required.", "docstring_type": "str", - "required": true + "required": true, + "method_location": "positional" } }, "async": { @@ -48,22 +50,25 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } }, "async": { @@ -71,19 +76,22 @@ "signature": "api_version: Optional[str] = None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "base_url": { "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", - "required": false + "required": false, + "method_location": "positional" }, "profile": { "signature": "profile: KnownProfiles = KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", - "required": false + "required": false, + "method_location": "positional" } } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py index db8abdba93dc..0849fcf2bc61 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -79,15 +79,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SecurityCenter + def __enter__(self) -> "SecurityCenter": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py index 5b78291ec454..d9a53c22b3e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py index c5692cc3dbe4..9c11d7c3fdd6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py @@ -42,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-01-preview"] + api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py index ce5d099e1e9a..cf3db08f0a7f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import SecurityConnectorsOperations @@ -49,7 +49,7 @@ def __init__( self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py index 342f7cc07e99..8aed71b2e9d8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py @@ -79,10 +79,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,7 +146,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group( @@ -167,10 +167,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,7 +192,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -208,7 +208,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -216,13 +216,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,7 +235,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace_async async def get( @@ -264,10 +266,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -279,9 +281,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +300,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def create_or_update( @@ -397,11 +401,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,9 +428,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -443,11 +447,13 @@ async def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload async def update( @@ -543,11 +549,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,9 +576,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -589,7 +595,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -618,10 +626,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +641,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -648,4 +656,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py index 3ae38c38dc10..15b0d0a8e79b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py @@ -86,7 +86,7 @@ from ._security_center_enums import SubPlan from ._security_center_enums import Type from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py index 29f7a7f69034..bf5f0d7320d1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py @@ -56,10 +56,10 @@ class EnvironmentData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = None # type: Optional[str] + self.environment_type: Optional[str] = None class AwsEnvironmentData(EnvironmentData): @@ -85,14 +85,14 @@ class AwsEnvironmentData(EnvironmentData): "organizational_data": {"key": "organizationalData", "type": "AwsOrganizationalData"}, } - def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs): + def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs: Any) -> None: """ :keyword organizational_data: The AWS account's organizational data. :paramtype organizational_data: ~azure.mgmt.security.v2022_08_01_preview.models.AwsOrganizationalData """ super().__init__(**kwargs) - self.environment_type = "AwsAccount" # type: str + self.environment_type: str = "AwsAccount" self.organizational_data = organizational_data @@ -125,10 +125,10 @@ class AwsOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class AwsOrganizationalDataMaster(AwsOrganizationalData): @@ -159,8 +159,8 @@ class AwsOrganizationalDataMaster(AwsOrganizationalData): } def __init__( - self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs - ): + self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword stackset_name: If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. @@ -170,7 +170,7 @@ def __init__( :paramtype excluded_account_ids: list[str] """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.stackset_name = stackset_name self.excluded_account_ids = excluded_account_ids @@ -198,14 +198,14 @@ class AwsOrganizationalDataMember(AwsOrganizationalData): "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, } - def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs): + def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. :paramtype parent_hierarchy_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id @@ -228,10 +228,10 @@ class AzureDevOpsScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "AzureDevOpsScope" # type: str + self.environment_type: str = "AzureDevOpsScope" class AzureTrackedResourceLocation(_serialization.Model): @@ -245,7 +245,7 @@ class AzureTrackedResourceLocation(_serialization.Model): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location where the resource is stored. :paramtype location: str @@ -288,7 +288,7 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -354,10 +354,10 @@ class CloudOffering(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = None # type: Optional[str] + self.offering_type: Optional[str] = None self.description = None @@ -400,15 +400,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAws" # type: str + self.offering_type: str = "CspmMonitorAws" self.native_cloud_connection = native_cloud_connection @@ -423,7 +423,7 @@ class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -460,10 +460,10 @@ class CspmMonitorAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorAzureDevOps" # type: str + self.offering_type: str = "CspmMonitorAzureDevOps" class CspmMonitorGcpOffering(CloudOffering): @@ -505,15 +505,15 @@ def __init__( self, *, native_cloud_connection: Optional["_models.CspmMonitorGcpOfferingNativeCloudConnection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGcp" # type: str + self.offering_type: str = "CspmMonitorGcp" self.native_cloud_connection = native_cloud_connection @@ -537,8 +537,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The GCP workload identity provider id for the offering. :paramtype workload_identity_provider_id: str @@ -579,10 +579,10 @@ class CspmMonitorGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "CspmMonitorGithub" # type: str + self.offering_type: str = "CspmMonitorGithub" class DefenderCspmAwsOffering(CloudOffering): @@ -617,14 +617,16 @@ class DefenderCspmAwsOffering(CloudOffering): "vm_scanners": {"key": "vmScanners", "type": "DefenderCspmAwsOfferingVmScanners"}, } - def __init__(self, *, vm_scanners: Optional["_models.DefenderCspmAwsOfferingVmScanners"] = None, **kwargs): + def __init__( + self, *, vm_scanners: Optional["_models.DefenderCspmAwsOfferingVmScanners"] = None, **kwargs: Any + ) -> None: """ :keyword vm_scanners: The Microsoft Defender for Server VM scanning configuration. :paramtype vm_scanners: ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderCspmAws" # type: str + self.offering_type: str = "DefenderCspmAws" self.vm_scanners = vm_scanners @@ -648,8 +650,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderCspmAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -685,8 +687,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -729,10 +731,10 @@ class DefenderCspmGcpOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderCspmGcp" # type: str + self.offering_type: str = "DefenderCspmGcp" class DefenderFoDatabasesAwsOffering(CloudOffering): @@ -778,8 +780,8 @@ def __init__( *, arc_auto_provisioning: Optional["_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning"] = None, rds: Optional["_models.DefenderFoDatabasesAwsOfferingRds"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -789,7 +791,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingRds """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesAws" # type: str + self.offering_type: str = "DefenderForDatabasesAws" self.arc_auto_provisioning = arc_auto_provisioning self.rds = rds @@ -808,7 +810,7 @@ class DefenderFoDatabasesAwsOfferingArcAutoProvisioning(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -834,7 +836,7 @@ class DefenderFoDatabasesAwsOfferingRds(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is RDS protection enabled. :paramtype enabled: bool @@ -943,8 +945,8 @@ def __init__( auto_provisioning: Optional[bool] = None, kube_audit_retention_time: Optional[int] = None, scuba_external_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kubernetes_service: The kubernetes service connection configuration. :paramtype kubernetes_service: @@ -979,7 +981,7 @@ def __init__( :paramtype scuba_external_id: str """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersAws" # type: str + self.offering_type: str = "DefenderForContainersAws" self.kubernetes_service = kubernetes_service self.kubernetes_scuba_reader = kubernetes_scuba_reader self.cloud_watch_to_kinesis = cloud_watch_to_kinesis @@ -1004,7 +1006,7 @@ class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. @@ -1025,7 +1027,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(_serializ "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1045,7 +1047,7 @@ class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(_seri "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1065,7 +1067,7 @@ class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. :paramtype cloud_role_arn: str @@ -1085,7 +1087,7 @@ class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. :paramtype cloud_role_arn: str @@ -1106,7 +1108,7 @@ class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning resources. @@ -1179,8 +1181,8 @@ def __init__( audit_logs_auto_provisioning_flag: Optional[bool] = None, defender_agent_auto_provisioning_flag: Optional[bool] = None, policy_agent_auto_provisioning_flag: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword native_cloud_connection: The native cloud connection configuration. :paramtype native_cloud_connection: @@ -1198,7 +1200,7 @@ def __init__( :paramtype policy_agent_auto_provisioning_flag: bool """ super().__init__(**kwargs) - self.offering_type = "DefenderForContainersGcp" # type: str + self.offering_type: str = "DefenderForContainersGcp" self.native_cloud_connection = native_cloud_connection self.data_pipeline_native_cloud_connection = data_pipeline_native_cloud_connection self.audit_logs_auto_provisioning_flag = audit_logs_auto_provisioning_flag @@ -1227,8 +1229,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The data collection service account email address in GCP for this offering. @@ -1262,8 +1264,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1326,8 +1328,8 @@ def __init__( defender_for_databases_arc_auto_provisioning: Optional[ "_models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. :paramtype arc_auto_provisioning: @@ -1338,7 +1340,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning """ super().__init__(**kwargs) - self.offering_type = "DefenderForDatabasesGcp" # type: str + self.offering_type: str = "DefenderForDatabasesGcp" self.arc_auto_provisioning = arc_auto_provisioning self.defender_for_databases_arc_auto_provisioning = defender_for_databases_arc_auto_provisioning @@ -1354,7 +1356,7 @@ class DefenderForDatabasesGcpOfferingArcAutoProvisioning(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1383,8 +1385,8 @@ def __init__( *, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_account_email_address: The service account email address in GCP for this offering. @@ -1426,10 +1428,10 @@ class DefenderForDevOpsAzureDevOpsOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderForDevOpsAzureDevOps" # type: str + self.offering_type: str = "DefenderForDevOpsAzureDevOps" class DefenderForDevOpsGithubOffering(CloudOffering): @@ -1460,10 +1462,10 @@ class DefenderForDevOpsGithubOffering(CloudOffering): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.offering_type = "DefenderForDevOpsGithub" # type: str + self.offering_type: str = "DefenderForDevOpsGithub" class DefenderForServersAwsOffering(CloudOffering): @@ -1540,8 +1542,8 @@ def __init__( mde_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersAwsOfferingSubPlan"] = None, vm_scanners: Optional["_models.DefenderForServersAwsOfferingVmScanners"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1564,7 +1566,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScanners """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersAws" # type: str + self.offering_type: str = "DefenderForServersAws" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1587,7 +1589,7 @@ class DefenderForServersAwsOfferingArcAutoProvisioning(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1610,7 +1612,7 @@ class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1633,7 +1635,7 @@ class DefenderForServersAwsOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1656,7 +1658,7 @@ class DefenderForServersAwsOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan @@ -1688,8 +1690,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -1714,7 +1716,7 @@ class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -1744,8 +1746,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersAwsOfferingVmScannersConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. :paramtype enabled: bool @@ -1781,8 +1783,8 @@ def __init__( cloud_role_arn: Optional[str] = None, scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, exclusion_tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -1866,8 +1868,8 @@ def __init__( va_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioning"] = None, mde_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingMdeAutoProvisioning"] = None, sub_plan: Optional["_models.DefenderForServersGcpOfferingSubPlan"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword defender_for_servers: The Defender for servers connection configuration. :paramtype defender_for_servers: @@ -1887,7 +1889,7 @@ def __init__( ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingSubPlan """ super().__init__(**kwargs) - self.offering_type = "DefenderForServersGcp" # type: str + self.offering_type: str = "DefenderForServersGcp" self.defender_for_servers = defender_for_servers self.arc_auto_provisioning = arc_auto_provisioning self.va_auto_provisioning = va_auto_provisioning @@ -1906,7 +1908,7 @@ class DefenderForServersGcpOfferingArcAutoProvisioning(_serialization.Model): "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enabled: Is arc auto provisioning enabled. :paramtype enabled: bool @@ -1934,8 +1936,8 @@ def __init__( *, workload_identity_provider_id: Optional[str] = None, service_account_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword workload_identity_provider_id: The workload identity provider id in GCP for this feature. @@ -1963,7 +1965,7 @@ class DefenderForServersGcpOfferingMdeAutoProvisioning(_serialization.Model): "configuration": {"key": "configuration", "type": "object"}, } - def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. :paramtype enabled: bool @@ -1986,7 +1988,7 @@ class DefenderForServersGcpOfferingSubPlan(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs: Any) -> None: """ :keyword type: The available sub plans. Known values are: "P1" and "P2". :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan @@ -2018,8 +2020,8 @@ def __init__( *, enabled: Optional[bool] = None, configuration: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. :paramtype enabled: bool @@ -2044,7 +2046,7 @@ class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(_serializatio "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs: Any) -> None: """ :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. Known values are: "Qualys" and "TVM". @@ -2075,7 +2077,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 @@ -2094,7 +2096,7 @@ class ETag(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Entity tag is used for comparing two or more entities from the same requested resource. @@ -2133,10 +2135,10 @@ class GcpOrganizationalData(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.organization_membership_type = None # type: Optional[str] + self.organization_membership_type: Optional[str] = None class GcpOrganizationalDataMember(GcpOrganizationalData): @@ -2167,8 +2169,12 @@ class GcpOrganizationalDataMember(GcpOrganizationalData): } def __init__( - self, *, parent_hierarchy_id: Optional[str] = None, management_project_number: Optional[str] = None, **kwargs - ): + self, + *, + parent_hierarchy_id: Optional[str] = None, + management_project_number: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword parent_hierarchy_id: If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. @@ -2178,7 +2184,7 @@ def __init__( :paramtype management_project_number: str """ super().__init__(**kwargs) - self.organization_membership_type = "Member" # type: str + self.organization_membership_type: str = "Member" self.parent_hierarchy_id = parent_hierarchy_id self.management_project_number = management_project_number @@ -2220,8 +2226,8 @@ def __init__( excluded_project_numbers: Optional[List[str]] = None, service_account_email_address: Optional[str] = None, workload_identity_provider_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword excluded_project_numbers: If the multi cloud account is of membership type organization, list of accounts excluded from offering. @@ -2234,7 +2240,7 @@ def __init__( :paramtype workload_identity_provider_id: str """ super().__init__(**kwargs) - self.organization_membership_type = "Organization" # type: str + self.organization_membership_type: str = "Organization" self.excluded_project_numbers = excluded_project_numbers self.service_account_email_address = service_account_email_address self.workload_identity_provider_id = workload_identity_provider_id @@ -2263,7 +2269,9 @@ class GcpProjectDetails(_serialization.Model): "workload_identity_pool_id": {"key": "workloadIdentityPoolId", "type": "str"}, } - def __init__(self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs): + def __init__( + self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword project_number: The unique GCP Project number. :paramtype project_number: str @@ -2307,8 +2315,8 @@ def __init__( *, organizational_data: Optional["_models.GcpOrganizationalData"] = None, project_details: Optional["_models.GcpProjectDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword organizational_data: The Gcp project's organizational data. :paramtype organizational_data: @@ -2317,7 +2325,7 @@ def __init__( :paramtype project_details: ~azure.mgmt.security.v2022_08_01_preview.models.GcpProjectDetails """ super().__init__(**kwargs) - self.environment_type = "GcpProject" # type: str + self.environment_type: str = "GcpProject" self.organizational_data = organizational_data self.project_details = project_details @@ -2341,10 +2349,10 @@ class GithubScopeEnvironmentData(EnvironmentData): "environment_type": {"key": "environmentType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.environment_type = "GithubScope" # type: str + self.environment_type: str = "GithubScope" class InformationProtectionAwsOffering(CloudOffering): @@ -2386,15 +2394,15 @@ def __init__( self, *, information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword information_protection: The native cloud connection configuration. :paramtype information_protection: ~azure.mgmt.security.v2022_08_01_preview.models.InformationProtectionAwsOfferingInformationProtection """ super().__init__(**kwargs) - self.offering_type = "InformationProtectionAws" # type: str + self.offering_type: str = "InformationProtectionAws" self.information_protection = information_protection @@ -2409,7 +2417,7 @@ class InformationProtectionAwsOfferingInformationProtection(_serialization.Model "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, } - def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. :paramtype cloud_role_arn: str @@ -2429,7 +2437,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -2463,7 +2471,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 @@ -2482,7 +2490,7 @@ class Tags(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2536,8 +2544,8 @@ def __init__( etag: Optional[str] = None, kind: Optional[str] = None, location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2635,8 +2643,8 @@ def __init__( environment_name: Optional[Union[str, "_models.CloudName"]] = None, offerings: Optional[List["_models.CloudOffering"]] = None, environment_data: Optional["_models.EnvironmentData"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: A list of key value pairs that describe the resource. :paramtype tags: dict[str, str] @@ -2690,7 +2698,7 @@ class SecurityConnectorsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs: Any) -> None: """ :keyword value: The list of security connectors under the given scope. Required. :paramtype value: list[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] @@ -2738,8 +2746,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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py index 4660a96abf0f..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py @@ -9,7 +9,7 @@ from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py index 908cc9cbd6fd..521a26854bf6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py @@ -45,9 +45,9 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,9 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,10 +146,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +186,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,9 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,10 +290,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -314,7 +314,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -330,7 +330,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -338,13 +338,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +357,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -376,10 +376,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + ) + cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +401,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,13 +425,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -444,7 +444,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + } @distributed_trace def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: @@ -471,10 +473,10 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -486,9 +488,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -505,7 +507,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def create_or_update( @@ -604,11 +608,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,9 +635,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,11 +654,13 @@ def create_or_update( deserialized = self._deserialize("SecurityConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @overload def update( @@ -750,11 +756,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -777,9 +783,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,7 +802,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -825,10 +833,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-08-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-08-01-preview") - ) # type: Literal["2022-08-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -840,9 +848,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -855,4 +863,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + }