diff --git a/sdk/automation/azure-mgmt-automation/_meta.json b/sdk/automation/azure-mgmt-automation/_meta.json index 7bf91d868f55..248b1a0c4049 100644 --- a/sdk/automation/azure-mgmt-automation/_meta.json +++ b/sdk/automation/azure-mgmt-automation/_meta.json @@ -1,11 +1,11 @@ { - "commit": "23b62d4e4dab07dccda851cfe50f6c6afb705a3b", + "commit": "3cfebb686624358dc61a959a71a7d8f10de0c228", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/automation/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py index 04362ae49337..272d8f388eb1 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py @@ -43,12 +43,15 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PackageOperations, + PackagesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, Python2PackageOperations, Python3PackageOperations, RunbookDraftOperations, RunbookOperations, + RuntimeEnvironmentsOperations, ScheduleOperations, SoftwareUpdateConfigurationMachineRunsOperations, SoftwareUpdateConfigurationRunsOperations, @@ -75,9 +78,15 @@ class AutomationClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Automation Client. - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.operations.NodeCountInformationOperations + :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations + :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations + :vartype deleted_automation_accounts: + azure.mgmt.automation.operations.DeletedAutomationAccountsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.automation.operations.PrivateLinkResourcesOperations @@ -88,24 +97,6 @@ class AutomationClient( :vartype dsc_node: azure.mgmt.automation.operations.DscNodeOperations :ivar node_reports: NodeReportsOperations operations :vartype node_reports: azure.mgmt.automation.operations.NodeReportsOperations - :ivar dsc_compilation_job: DscCompilationJobOperations operations - :vartype dsc_compilation_job: azure.mgmt.automation.operations.DscCompilationJobOperations - :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations - :vartype dsc_compilation_job_stream: - azure.mgmt.automation.operations.DscCompilationJobStreamOperations - :ivar node_count_information: NodeCountInformationOperations operations - :vartype node_count_information: - azure.mgmt.automation.operations.NodeCountInformationOperations - :ivar watcher: WatcherOperations operations - :vartype watcher: azure.mgmt.automation.operations.WatcherOperations - :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations - :vartype software_update_configurations: - azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations - :ivar webhook: WebhookOperations operations - :vartype webhook: azure.mgmt.automation.operations.WebhookOperations - :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations - :vartype deleted_automation_accounts: - azure.mgmt.automation.operations.DeletedAutomationAccountsOperations :ivar automation_account: AutomationAccountOperations operations :vartype automation_account: azure.mgmt.automation.operations.AutomationAccountOperations :ivar statistics: StatisticsOperations operations @@ -122,6 +113,11 @@ class AutomationClient( :vartype connection_type: azure.mgmt.automation.operations.ConnectionTypeOperations :ivar credential: CredentialOperations operations :vartype credential: azure.mgmt.automation.operations.CredentialOperations + :ivar dsc_compilation_job: DscCompilationJobOperations operations + :vartype dsc_compilation_job: azure.mgmt.automation.operations.DscCompilationJobOperations + :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations + :vartype dsc_compilation_job_stream: + azure.mgmt.automation.operations.DscCompilationJobStreamOperations :ivar dsc_configuration: DscConfigurationOperations operations :vartype dsc_configuration: azure.mgmt.automation.operations.DscConfigurationOperations :ivar dsc_node_configuration: DscNodeConfigurationOperations operations @@ -151,6 +147,13 @@ class AutomationClient( :vartype fields: azure.mgmt.automation.operations.FieldsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.automation.operations.Operations + :ivar package: PackageOperations operations + :vartype package: azure.mgmt.automation.operations.PackageOperations + :ivar packages: PackagesOperations operations + :vartype packages: azure.mgmt.automation.operations.PackagesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations :ivar python2_package: Python2PackageOperations operations :vartype python2_package: azure.mgmt.automation.operations.Python2PackageOperations :ivar python3_package: Python3PackageOperations operations @@ -163,6 +166,8 @@ class AutomationClient( :vartype test_job_streams: azure.mgmt.automation.operations.TestJobStreamsOperations :ivar test_job: TestJobOperations operations :vartype test_job: azure.mgmt.automation.operations.TestJobOperations + :ivar runtime_environments: RuntimeEnvironmentsOperations operations + :vartype runtime_environments: azure.mgmt.automation.operations.RuntimeEnvironmentsOperations :ivar schedule: ScheduleOperations operations :vartype schedule: azure.mgmt.automation.operations.ScheduleOperations :ivar software_update_configuration_machine_runs: @@ -182,6 +187,10 @@ class AutomationClient( azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations :ivar variable: VariableOperations operations :vartype variable: azure.mgmt.automation.operations.VariableOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.operations.WatcherOperations + :ivar webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.operations.WebhookOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure @@ -189,6 +198,9 @@ class AutomationClient( :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 "2023-05-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -201,40 +213,29 @@ def __init__( **kwargs: Any ) -> None: self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.agent_registration_information = AgentRegistrationInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_compilation_job = DscCompilationJobOperations( + self.node_count_information = NodeCountInformationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.node_count_information = NodeCountInformationOperations( + self.deleted_automation_accounts = DeletedAutomationAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configurations = SoftwareUpdateConfigurationsOperations( + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) - self.deleted_automation_accounts = DeletedAutomationAccountsOperations( + self.agent_registration_information = AgentRegistrationInformationOperations( self._client, self._config, self._serialize, self._deserialize ) + self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -245,6 +246,12 @@ def __init__( self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + self.dsc_compilation_job = DscCompilationJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dsc_configuration = DscConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -270,12 +277,20 @@ def __init__( ) self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.packages = PackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.python3_package = Python3PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_environments = RuntimeEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( self._client, self._config, self._serialize, self._deserialize @@ -291,6 +306,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -321,5 +338,5 @@ def __enter__(self) -> "AutomationClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py index 1224b5cc6c68..0a54911db7e6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py @@ -30,10 +30,15 @@ class AutomationClientConfiguration(Configuration): # pylint: disable=too-many- :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-05-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AutomationClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-05-15-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -41,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs 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-automation/{}".format(VERSION)) self._configure(**kwargs) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py index 2bd6526d54d6..f452f3670eb3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py @@ -27,17 +27,6 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - class AutomationClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py index 73aef742777f..e5754a47ce68 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py index 4a916016e428..9750a7183a98 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py @@ -43,12 +43,15 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PackageOperations, + PackagesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, Python2PackageOperations, Python3PackageOperations, RunbookDraftOperations, RunbookOperations, + RuntimeEnvironmentsOperations, ScheduleOperations, SoftwareUpdateConfigurationMachineRunsOperations, SoftwareUpdateConfigurationRunsOperations, @@ -75,9 +78,15 @@ class AutomationClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Automation Client. - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.aio.operations.NodeCountInformationOperations + :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations + :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations + :vartype deleted_automation_accounts: + azure.mgmt.automation.aio.operations.DeletedAutomationAccountsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.automation.aio.operations.PrivateLinkResourcesOperations @@ -88,24 +97,6 @@ class AutomationClient( :vartype dsc_node: azure.mgmt.automation.aio.operations.DscNodeOperations :ivar node_reports: NodeReportsOperations operations :vartype node_reports: azure.mgmt.automation.aio.operations.NodeReportsOperations - :ivar dsc_compilation_job: DscCompilationJobOperations operations - :vartype dsc_compilation_job: azure.mgmt.automation.aio.operations.DscCompilationJobOperations - :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations - :vartype dsc_compilation_job_stream: - azure.mgmt.automation.aio.operations.DscCompilationJobStreamOperations - :ivar node_count_information: NodeCountInformationOperations operations - :vartype node_count_information: - azure.mgmt.automation.aio.operations.NodeCountInformationOperations - :ivar watcher: WatcherOperations operations - :vartype watcher: azure.mgmt.automation.aio.operations.WatcherOperations - :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations - :vartype software_update_configurations: - azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations - :ivar webhook: WebhookOperations operations - :vartype webhook: azure.mgmt.automation.aio.operations.WebhookOperations - :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations - :vartype deleted_automation_accounts: - azure.mgmt.automation.aio.operations.DeletedAutomationAccountsOperations :ivar automation_account: AutomationAccountOperations operations :vartype automation_account: azure.mgmt.automation.aio.operations.AutomationAccountOperations :ivar statistics: StatisticsOperations operations @@ -122,6 +113,11 @@ class AutomationClient( :vartype connection_type: azure.mgmt.automation.aio.operations.ConnectionTypeOperations :ivar credential: CredentialOperations operations :vartype credential: azure.mgmt.automation.aio.operations.CredentialOperations + :ivar dsc_compilation_job: DscCompilationJobOperations operations + :vartype dsc_compilation_job: azure.mgmt.automation.aio.operations.DscCompilationJobOperations + :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations + :vartype dsc_compilation_job_stream: + azure.mgmt.automation.aio.operations.DscCompilationJobStreamOperations :ivar dsc_configuration: DscConfigurationOperations operations :vartype dsc_configuration: azure.mgmt.automation.aio.operations.DscConfigurationOperations :ivar dsc_node_configuration: DscNodeConfigurationOperations operations @@ -151,6 +147,13 @@ class AutomationClient( :vartype fields: azure.mgmt.automation.aio.operations.FieldsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.automation.aio.operations.Operations + :ivar package: PackageOperations operations + :vartype package: azure.mgmt.automation.aio.operations.PackageOperations + :ivar packages: PackagesOperations operations + :vartype packages: azure.mgmt.automation.aio.operations.PackagesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations :ivar python2_package: Python2PackageOperations operations :vartype python2_package: azure.mgmt.automation.aio.operations.Python2PackageOperations :ivar python3_package: Python3PackageOperations operations @@ -163,6 +166,9 @@ class AutomationClient( :vartype test_job_streams: azure.mgmt.automation.aio.operations.TestJobStreamsOperations :ivar test_job: TestJobOperations operations :vartype test_job: azure.mgmt.automation.aio.operations.TestJobOperations + :ivar runtime_environments: RuntimeEnvironmentsOperations operations + :vartype runtime_environments: + azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations :ivar schedule: ScheduleOperations operations :vartype schedule: azure.mgmt.automation.aio.operations.ScheduleOperations :ivar software_update_configuration_machine_runs: @@ -182,6 +188,10 @@ class AutomationClient( azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations :ivar variable: VariableOperations operations :vartype variable: azure.mgmt.automation.aio.operations.VariableOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.aio.operations.WatcherOperations + :ivar webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.aio.operations.WebhookOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure @@ -189,6 +199,9 @@ class AutomationClient( :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 "2023-05-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -201,40 +214,29 @@ def __init__( **kwargs: Any ) -> None: self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.agent_registration_information = AgentRegistrationInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_compilation_job = DscCompilationJobOperations( + self.node_count_information = NodeCountInformationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.node_count_information = NodeCountInformationOperations( + self.deleted_automation_accounts = DeletedAutomationAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configurations = SoftwareUpdateConfigurationsOperations( + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) - self.deleted_automation_accounts = DeletedAutomationAccountsOperations( + self.agent_registration_information = AgentRegistrationInformationOperations( self._client, self._config, self._serialize, self._deserialize ) + self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -245,6 +247,12 @@ def __init__( self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + self.dsc_compilation_job = DscCompilationJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dsc_configuration = DscConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -270,12 +278,20 @@ def __init__( ) self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.packages = PackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.python3_package = Python3PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_environments = RuntimeEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( self._client, self._config, self._serialize, self._deserialize @@ -291,6 +307,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -321,5 +339,5 @@ async def __aenter__(self) -> "AutomationClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py index 06cbd251fdb0..adfca218f853 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py @@ -30,10 +30,15 @@ class AutomationClientConfiguration(Configuration): # pylint: disable=too-many- :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-05-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AutomationClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-05-15-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -41,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k 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-automation/{}".format(VERSION)) self._configure(**kwargs) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py index ceadd5d1de73..0487495d9bdf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py @@ -6,18 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._node_count_information_operations import NodeCountInformationOperations +from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations +from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._agent_registration_information_operations import AgentRegistrationInformationOperations from ._dsc_node_operations import DscNodeOperations from ._node_reports_operations import NodeReportsOperations -from ._dsc_compilation_job_operations import DscCompilationJobOperations -from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations -from ._node_count_information_operations import NodeCountInformationOperations -from ._watcher_operations import WatcherOperations -from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations -from ._webhook_operations import WebhookOperations -from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations from ._automation_account_operations import AutomationAccountOperations from ._statistics_operations import StatisticsOperations from ._usages_operations import UsagesOperations @@ -26,6 +21,8 @@ from ._connection_operations import ConnectionOperations from ._connection_type_operations import ConnectionTypeOperations from ._credential_operations import CredentialOperations +from ._dsc_compilation_job_operations import DscCompilationJobOperations +from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from ._dsc_configuration_operations import DscConfigurationOperations from ._dsc_node_configuration_operations import DscNodeConfigurationOperations from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations @@ -40,12 +37,16 @@ from ._fields_operations import FieldsOperations from ._operations import Operations from ._automation_client_operations import AutomationClientOperationsMixin +from ._package_operations import PackageOperations +from ._packages_operations import PackagesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._python2_package_operations import Python2PackageOperations from ._python3_package_operations import Python3PackageOperations from ._runbook_draft_operations import RunbookDraftOperations from ._runbook_operations import RunbookOperations from ._test_job_streams_operations import TestJobStreamsOperations from ._test_job_operations import TestJobOperations +from ._runtime_environments_operations import RuntimeEnvironmentsOperations from ._schedule_operations import ScheduleOperations from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations @@ -53,24 +54,21 @@ from ._source_control_sync_job_operations import SourceControlSyncJobOperations from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations from ._variable_operations import VariableOperations +from ._watcher_operations import WatcherOperations +from ._webhook_operations import WebhookOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PrivateEndpointConnectionsOperations", + "NodeCountInformationOperations", + "SoftwareUpdateConfigurationsOperations", + "DeletedAutomationAccountsOperations", "PrivateLinkResourcesOperations", "AgentRegistrationInformationOperations", "DscNodeOperations", "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "NodeCountInformationOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "WebhookOperations", - "DeletedAutomationAccountsOperations", "AutomationAccountOperations", "StatisticsOperations", "UsagesOperations", @@ -79,6 +77,8 @@ "ConnectionOperations", "ConnectionTypeOperations", "CredentialOperations", + "DscCompilationJobOperations", + "DscCompilationJobStreamOperations", "DscConfigurationOperations", "DscNodeConfigurationOperations", "HybridRunbookWorkersOperations", @@ -93,12 +93,16 @@ "FieldsOperations", "Operations", "AutomationClientOperationsMixin", + "PackageOperations", + "PackagesOperations", + "PrivateEndpointConnectionsOperations", "Python2PackageOperations", "Python3PackageOperations", "RunbookDraftOperations", "RunbookOperations", "TestJobStreamsOperations", "TestJobOperations", + "RuntimeEnvironmentsOperations", "ScheduleOperations", "SoftwareUpdateConfigurationMachineRunsOperations", "SoftwareUpdateConfigurationRunsOperations", @@ -106,6 +110,8 @@ "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", "VariableOperations", + "WatcherOperations", + "WebhookOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py index 48d5318457f7..3428c3feca2e 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -31,10 +31,6 @@ from ...operations._activity_operations import build_get_request, build_list_by_module_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ async def get( ) -> _models.Activity: """Retrieve the activity in the module identified by module name and activity name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +92,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +109,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,6 +138,9 @@ def list_by_module( ) -> AsyncIterable["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -152,7 +155,7 @@ def list_by_module( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) error_map = { @@ -180,7 +183,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -196,8 +210,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py index 3615ea66bc8f..a1f04ce1a893 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +29,6 @@ from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request from .._vendor import AutomationClientMixinABC -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]] @@ -62,6 +58,9 @@ async def get( ) -> _models.AgentRegistration: """Retrieve the automation agent registration information. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +96,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +131,9 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -160,6 +161,9 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -185,12 +189,15 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a model - type or a IO type. Required. + :param parameters: The name of the agent registration key to be regenerated. Is either a + AgentRegistrationRegenerateKeyParameter type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -211,16 +218,14 @@ async def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") @@ -240,8 +245,9 @@ async def regenerate_key( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py index d6ddc08bfb00..0af204a0bad5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,15 +34,12 @@ build_delete_request, build_get_request, build_list_by_resource_group_request, + build_list_deleted_runbooks_request, build_list_request, build_update_request, ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +75,9 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -104,6 +105,9 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -129,12 +133,15 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the update automation account. Is either a + AutomationAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -155,14 +162,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") @@ -182,8 +189,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,6 +224,9 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -243,6 +254,9 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -268,12 +282,15 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param parameters: Parameters supplied to the create or update automation account. Is either a - model type or a IO type. Required. + AutomationAccountCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,14 +311,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") @@ -321,8 +338,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,6 +371,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -373,7 +394,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -388,8 +409,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,6 +434,9 @@ async def get( ) -> _models.AutomationAccount: """Get information about an Automation Account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -432,7 +457,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -447,8 +472,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,6 +501,9 @@ def list_by_resource_group( ) -> AsyncIterable["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -486,7 +515,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -512,7 +541,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -528,8 +568,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,7 +602,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutomationAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -586,7 +627,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -602,8 +654,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -617,3 +670,94 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts"} + + @distributed_trace + def list_deleted_runbooks( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DeletedRunbook"]: + """Retrieve the deleted runbooks for an automation account. + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedRunbook or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DeletedRunbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeletedRunbookListResult] = 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_deleted_runbooks_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted_runbooks.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("DeletedRunbookListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_deleted_runbooks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listDeletedRunbooks" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py index ef0c01c9f234..f2f0a30bff8c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +29,6 @@ from ...operations._automation_client_operations import build_convert_graph_runbook_content_request from .._vendor import AutomationClientMixinABC -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]] @@ -106,8 +102,8 @@ async def convert_graph_runbook_content( :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Input data describing the graphical runbook. Is either a model type or a IO - type. Required. + :param parameters: Input data describing the graphical runbook. Is either a + GraphicalRunbookContent type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -128,14 +124,14 @@ async def convert_graph_runbook_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GraphicalRunbookContent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GraphicalRunbookContent") @@ -155,8 +151,9 @@ async def convert_graph_runbook_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py index 5379dc31ca25..2a788d4a9659 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Certificate: """Retrieve the certificate identified by certificate name. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +245,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +278,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +289,7 @@ async def create_or_update( Required. :type certificate_name: str :param parameters: The parameters supplied to the create or update certificate operation. Is - either a model type or a IO type. Required. + either a CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +310,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -324,8 +338,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +378,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +411,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +442,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +452,7 @@ async def update( :param certificate_name: The parameters supplied to the update certificate operation. Required. :type certificate_name: str :param parameters: The parameters supplied to the update certificate operation. Is either a - model type or a IO type. Required. + CertificateUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +473,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateUpdateParameters") @@ -477,8 +501,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +530,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Certificate"]: """Retrieve a list of certificates. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +545,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) error_map = { @@ -544,7 +572,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -560,8 +599,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py index 2a8289659e0f..703b63e237d6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Connection: """Retrieve the connection identified by connection name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +245,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +278,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +289,7 @@ async def create_or_update( Required. :type connection_name: str :param parameters: The parameters supplied to the create or update connection operation. Is - either a model type or a IO type. Required. + either a ConnectionCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +310,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") @@ -324,8 +338,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +378,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +411,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +442,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +452,7 @@ async def update( :param connection_name: The parameters supplied to the update a connection operation. Required. :type connection_name: str :param parameters: The parameters supplied to the update a connection operation. Is either a - model type or a IO type. Required. + ConnectionUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +473,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionUpdateParameters") @@ -477,8 +501,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +530,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Connection"]: """Retrieve a list of connections. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +545,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -544,7 +572,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -560,8 +599,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py index e51ac98d5238..a02399cb81c1 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -107,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,6 +132,9 @@ async def get( ) -> _models.ConnectionType: """Retrieve the connection type identified by connection type name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -153,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) request = build_get_request( @@ -169,8 +173,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,6 +209,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -236,6 +244,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -266,6 +277,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -274,7 +288,7 @@ async def create_or_update( operation. Required. :type connection_type_name: str :param parameters: The parameters supplied to the create or update connection type operation. - Is either a model type or a IO type. Required. + Is either a ConnectionTypeCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -295,14 +309,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") @@ -323,8 +337,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,6 +366,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.ConnectionType"]: """Retrieve a list of connection types. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +381,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -390,7 +408,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -406,8 +435,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py index 75800d5637d1..1056058b6723 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Credential: """Retrieve the credential identified by credential name. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +245,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +278,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +289,7 @@ async def create_or_update( Required. :type credential_name: str :param parameters: The parameters supplied to the create or update credential operation. Is - either a model type or a IO type. Required. + either a CredentialCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +310,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") @@ -324,8 +338,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +378,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +411,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +442,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +452,7 @@ async def update( :param credential_name: The parameters supplied to the Update credential operation. Required. :type credential_name: str :param parameters: The parameters supplied to the Update credential operation. Is either a - model type or a IO type. Required. + CredentialUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +473,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialUpdateParameters") @@ -477,8 +501,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +530,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Credential"]: """Retrieve a list of credentials. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +545,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) error_map = { @@ -544,7 +572,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -560,8 +599,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py index 1035080d3af2..e1aaba565758 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._deleted_automation_accounts_operations import build_list_by_subscription_request from .._vendor import AutomationClientMixinABC -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]] @@ -76,7 +71,7 @@ async def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomation _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) request = build_list_by_subscription_request( @@ -89,8 +84,9 @@ async def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomation request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py index 46bf8b413117..2f4f63ff953c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,10 +39,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -84,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscCompilationJobCreateParameters") @@ -114,8 +109,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,6 +145,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,6 +186,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -223,6 +225,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -230,7 +235,7 @@ async def begin_create( :param compilation_job_name: The DSC configuration Id. Required. :type compilation_job_name: str :param parameters: The parameters supplied to the create compilation job operation. Is either a - model type or a IO type. Required. + DscCompilationJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -251,9 +256,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -305,6 +308,9 @@ async def get( ) -> _models.DscCompilationJob: """Retrieve the Dsc configuration compilation job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dsccompilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -327,9 +333,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) request = build_get_request( @@ -345,8 +349,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,6 +378,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/compilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,9 +396,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) error_map = { @@ -418,7 +424,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -434,8 +451,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,6 +476,9 @@ async def get_stream( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -482,9 +503,7 @@ async def get_stream( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_stream_request( @@ -501,8 +520,9 @@ async def get_stream( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py index cf2858b8ec2c..124eae3f1436 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request from .._vendor import AutomationClientMixinABC -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]] @@ -62,6 +57,9 @@ async def list_by_job( ) -> _models.JobStreamListResult: """Retrieve all the job streams for the compilation Job. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -84,9 +82,7 @@ async def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) request = build_list_by_job_request( @@ -102,8 +98,9 @@ async def list_by_job( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py index 8235b0d6417f..a8138de7ffc8 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py @@ -6,8 +6,8 @@ # 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, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -71,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +133,9 @@ async def get( ) -> _models.DscConfiguration: """Retrieve the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -171,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,6 +210,9 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -236,6 +243,9 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -264,14 +274,17 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationCreateOrUpdateParameters type or a str type. Required. :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -292,7 +305,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -320,8 +333,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,6 +373,9 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -389,6 +406,9 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -417,14 +437,17 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Default value is None. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationUpdateParameters type or a str type. Default value is None. :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -445,7 +468,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -479,8 +502,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,6 +531,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the configuration script identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -529,7 +556,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -545,8 +572,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -579,6 +607,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscConfiguration"]: """Retrieve a list of configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -599,7 +630,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -630,7 +661,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -646,8 +688,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py index 9f8e09ce19bf..cb010a1d0ae5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,10 +39,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -71,6 +68,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +93,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +109,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +134,9 @@ async def get( ) -> _models.DscNodeConfiguration: """Retrieve the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +159,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -171,8 +175,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,14 +217,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscNodeConfigurationCreateOrUpdateParameters") @@ -240,8 +245,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -274,9 +280,12 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,9 +321,12 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -348,17 +360,20 @@ async def begin_create_or_update( node_configuration_name: str, parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param node_configuration_name: The Dsc node configuration name. Required. :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a IO type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscNodeConfigurationCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -380,7 +395,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -439,6 +454,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -461,7 +479,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -492,7 +510,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -508,8 +537,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py index 90db769927b8..cc0de5ac3fd8 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,9 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +132,9 @@ async def get( ) -> _models.DscNode: """Retrieve the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,9 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) request = build_get_request( @@ -173,8 +173,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -208,6 +209,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -238,6 +242,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -266,6 +273,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -273,7 +283,7 @@ async def update( :param node_id: Parameters supplied to the update dsc node. Required. :type node_id: str :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - model type or a IO type. Required. + DscNodeUpdateParameters type or a IO type. Required. :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,16 +304,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dsc_node_update_parameters, (IO, bytes)): + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): _content = dsc_node_update_parameters else: _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") @@ -324,8 +332,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,6 +368,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscNode"]: """Retrieve a list of dsc nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -379,9 +391,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) error_map = { @@ -412,7 +422,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -428,8 +449,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py index bf24b786c68e..dcae2bfac46f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -30,10 +30,6 @@ from ...operations._fields_operations import build_list_by_type_request from .._vendor import AutomationClientMixinABC -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]] @@ -63,6 +59,9 @@ def list_by_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/typefieldoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -79,7 +78,7 @@ def list_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -108,7 +107,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -124,8 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py index f806c6b894b2..2b646784ac1c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -74,6 +71,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -96,7 +96,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -112,8 +112,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,6 +141,9 @@ async def get( ) -> _models.HybridRunbookWorkerGroup: """Retrieve a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -162,7 +166,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -178,8 +182,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,6 +218,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -245,6 +253,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -276,6 +287,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -283,7 +297,8 @@ async def create( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for - hybrid runbook worker group. Is either a model type or a IO type. Required. + hybrid runbook worker group. Is either a HybridRunbookWorkerGroupCreateOrUpdateParameters type + or a IO type. Required. :type hybrid_runbook_worker_group_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -305,14 +320,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_creation_parameters else: _json = self._serialize.body( @@ -335,8 +350,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +390,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -406,6 +425,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +459,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -444,7 +469,7 @@ async def update( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_updation_parameters: The hybrid runbook worker group. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO type. Required. :type hybrid_runbook_worker_group_updation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -466,14 +491,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_updation_parameters else: _json = self._serialize.body( @@ -496,8 +521,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,6 +550,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -540,7 +569,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) error_map = { @@ -568,7 +597,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -584,8 +624,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py index 250602e6afec..ecac269197b1 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,13 +35,10 @@ build_get_request, build_list_by_hybrid_runbook_worker_group_request, build_move_request, + build_patch_request, ) from .._vendor import AutomationClientMixinABC -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]] @@ -75,6 +73,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -99,7 +100,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -116,8 +117,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,6 +147,9 @@ async def get( ) -> _models.HybridRunbookWorker: """Retrieve a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -169,7 +174,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) request = build_get_request( @@ -186,8 +191,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,6 +228,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -257,6 +266,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -289,6 +301,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -298,7 +313,7 @@ async def create( :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid - runbook worker. Is either a model type or a IO type. Required. + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Required. :type hybrid_runbook_worker_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -320,14 +335,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_creation_parameters else: _json = self._serialize.body( @@ -351,8 +366,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,6 +393,187 @@ async def create( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" } + @overload + async def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[_models.HybridRunbookWorkerCreateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Default value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters + :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: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Default value is None. + :type hybrid_runbook_worker_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[ + Union[_models.HybridRunbookWorkerCreateParameters, IO] + ] = None, + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Default + value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters 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: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + if hybrid_runbook_worker_creation_parameters is not None: + _json = self._serialize.body( + hybrid_runbook_worker_creation_parameters, "HybridRunbookWorkerCreateParameters" + ) + else: + _json = None + + request = build_patch_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, + hybrid_runbook_worker_id=hybrid_runbook_worker_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HybridRunbookWorker", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + } + @overload async def move( # pylint: disable=inconsistent-return-statements self, @@ -391,6 +588,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -426,6 +626,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,6 +661,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -467,7 +673,7 @@ async def move( # pylint: disable=inconsistent-return-statements :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerMoveParameters type or a IO type. Required. :type hybrid_runbook_worker_move_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -489,14 +695,14 @@ async def move( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_move_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_move_parameters else: _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") @@ -518,8 +724,9 @@ async def move( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,6 +754,9 @@ def list_by_hybrid_runbook_worker_group( ) -> AsyncIterable["_models.HybridRunbookWorker"]: """Retrieve a list of hybrid runbook workers. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -564,7 +774,7 @@ def list_by_hybrid_runbook_worker_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) error_map = { @@ -593,7 +803,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -609,8 +830,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py index 294a6b54fe5f..18eaf494819b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -40,10 +41,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -78,6 +75,9 @@ async def get_output( ) -> str: """Retrieve the job output identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -102,7 +102,7 @@ async def get_output( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_output_request( @@ -119,8 +119,9 @@ async def get_output( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,6 +152,9 @@ async def get_runbook_content( ) -> str: """Retrieve the runbook content of the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -175,7 +179,7 @@ async def get_runbook_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_runbook_content_request( @@ -192,8 +196,9 @@ async def get_runbook_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,6 +229,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -248,7 +256,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -265,8 +273,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,6 +303,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -318,7 +330,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -335,8 +347,9 @@ async def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,6 +377,9 @@ async def get( ) -> _models.Job: """Retrieve the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,7 +404,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +421,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,6 +458,9 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,6 +494,9 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -505,14 +528,17 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param job_name: The job name. Required. :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a model type - or a IO type. Required. + :param parameters: The parameters supplied to the create job operation. Is either a + JobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -535,14 +561,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobCreateParameters") @@ -564,8 +590,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,6 +624,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.JobCollectionItem"]: """Retrieve a list of jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -614,7 +644,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) error_map = { @@ -643,7 +673,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -659,8 +700,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,6 +730,9 @@ async def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -712,7 +757,7 @@ async def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -729,8 +774,9 @@ async def resume( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py index 1b87fe2cc35c..b781bb7e4264 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -107,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,6 +132,9 @@ async def get( ) -> _models.JobSchedule: """Retrieve the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -153,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -169,8 +173,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,6 +209,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -234,6 +242,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +273,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -269,7 +283,7 @@ async def create( :param job_schedule_id: The job schedule name. Required. :type job_schedule_id: str :param parameters: The parameters supplied to the create job schedule operation. Is either a - model type or a IO type. Required. + JobScheduleCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -290,14 +304,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobScheduleCreateParameters") @@ -318,8 +332,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,6 +361,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.JobSchedule"]: """Retrieve a list of job schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -360,7 +378,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -388,7 +406,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -404,8 +433,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py index b815bac87793..3fed1d99ee4d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -31,10 +31,6 @@ from ...operations._job_stream_operations import build_get_request, build_list_by_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def get( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -96,7 +95,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -114,8 +113,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,6 +148,9 @@ def list_by_job( ) -> AsyncIterable["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -166,7 +169,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -196,7 +199,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -212,8 +226,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py index 8f4a8d9484f8..b4398f811285 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._keys_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -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]] @@ -82,7 +77,7 @@ async def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) request = build_list_by_automation_account_request( @@ -97,8 +92,9 @@ async def list_by_automation_account( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py index c383a374464f..4f4029a65d29 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._linked_workspace_operations import build_get_request from .._vendor import AutomationClientMixinABC -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]] @@ -62,6 +57,9 @@ async def get( ) -> _models.LinkedWorkspace: """Retrieve the linked workspace for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/linkedworkspaceoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,7 +80,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) request = build_get_request( @@ -97,8 +95,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py index f6de70a18d40..2f51bdf47ad5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the module by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Module: """Retrieve the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +243,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +274,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The create or update parameters for module. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +305,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") @@ -319,8 +333,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +373,9 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +406,9 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +437,17 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The update parameters for module. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +468,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleUpdateParameters") @@ -472,8 +496,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +525,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +540,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -539,7 +567,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -555,8 +594,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py index 9c3773f1b89b..805667bbe3cf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._node_count_information_operations import build_get_request from .._vendor import AutomationClientMixinABC -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]] @@ -66,6 +61,9 @@ async def get( ) -> _models.NodeCounts: """Retrieve counts for Dsc Nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/nodecounts + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -89,9 +87,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) request = build_get_request( @@ -107,8 +103,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py index f69a5d6d25f4..4ccad99777d9 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py @@ -8,6 +8,7 @@ # -------------------------------------------------------------------------- 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 ( @@ -39,10 +40,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,6 +75,9 @@ def list_by_node( ) -> AsyncIterable["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -94,9 +94,7 @@ def list_by_node( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) error_map = { @@ -125,7 +123,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -141,8 +150,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,6 +175,9 @@ async def get( ) -> _models.DscNodeReport: """Retrieve the Dsc node report data by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -189,9 +202,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) request = build_get_request( @@ -208,8 +219,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,6 +248,9 @@ async def get_content( ) -> JSON: """Retrieve the Dsc node reports by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -260,9 +275,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_get_content_request( @@ -279,8 +292,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py index 2a5725fd5a63..745f7ebdc894 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -33,10 +33,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -66,6 +62,9 @@ def list_fields_by_module_and_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,7 +81,7 @@ def list_fields_by_module_and_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -111,7 +110,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -127,8 +137,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,6 +162,9 @@ def list_fields_by_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -165,7 +179,7 @@ def list_fields_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -193,7 +207,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -209,8 +234,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py index 3599d8fec14d..b777ef9dc2fe 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -30,10 +30,6 @@ from ...operations._operations import build_list_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +65,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -93,7 +89,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -109,8 +116,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_package_operations.py new file mode 100644 index 000000000000..270c292217da --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_package_operations.py @@ -0,0 +1,553 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, 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._package_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_update_request, +) +from .._vendor import AutomationClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`package` 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 delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> None: + """Delete the package by name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> _models.Package: + """Retrieve the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters + :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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Is either a + PackageCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters 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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PackageCreateOrUpdateParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Package", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters + :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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageUpdateParameters, IO], + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Is either a PackageUpdateParameters type + or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters 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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PackageUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_packages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_packages_operations.py new file mode 100644 index 000000000000..18e1715887ba --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_packages_operations.py @@ -0,0 +1,151 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._packages_operations import build_list_by_runtime_environment_request +from .._vendor import AutomationClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`packages` 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_by_runtime_environment( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Package"]: + """Retrieve the a list of Packages. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Package or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Package] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageListResult] = 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_by_runtime_environment_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_runtime_environment.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("PackageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_runtime_environment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py index 5325585a9f77..d597ac762ead 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,10 +39,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -85,9 +82,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -114,7 +109,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -130,8 +136,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,9 +186,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +202,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,16 +243,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -267,8 +271,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,7 +391,7 @@ async def begin_create_or_update( :type automation_account_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -408,9 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -474,9 +477,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -492,8 +493,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,8 +505,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}" @@ -541,9 +547,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py index b31120697d9a..e21bb1bd13dd 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -30,10 +30,6 @@ from ...operations._private_link_resources_operations import build_automation_request from .._vendor import AutomationClientMixinABC -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]] @@ -76,9 +72,7 @@ def automation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -105,7 +99,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -121,8 +126,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py index 7422ff40e17e..799526c79a05 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 2 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Module: """Retrieve the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +243,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +274,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +305,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -319,8 +333,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +373,9 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +406,9 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +437,17 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +468,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -472,8 +496,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +525,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of python 2 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +540,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -539,7 +567,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -555,8 +594,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py index eb2d17821588..85b81fe17865 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 3 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def get( ) -> _models.Module: """Retrieve the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +174,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +210,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +243,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +274,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +305,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -319,8 +333,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +373,9 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +406,9 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +437,17 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +468,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -472,8 +496,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +525,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of python 3 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +540,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -539,7 +567,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -555,8 +594,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py index f2bab4dec2f3..8c57bc934591 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -36,10 +35,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +64,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the content of runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +89,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -107,8 +105,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +146,7 @@ async def _replace_content_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[AsyncIterator[bytes]]] = kwargs.pop("cls", None) @@ -168,8 +167,9 @@ async def _replace_content_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,6 +207,9 @@ async def begin_replace_content( ) -> AsyncLROPoller[AsyncIterator[bytes]]: """Replaces the runbook draft content. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -231,7 +234,7 @@ async def begin_replace_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -286,6 +289,9 @@ async def get( ) -> _models.RunbookDraft: """Retrieve the runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -308,7 +314,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +330,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,6 +359,9 @@ async def undo_edit( ) -> _models.RunbookDraftUndoEditResult: """Undo draft edit to last known published state identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -374,7 +384,7 @@ async def undo_edit( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) request = build_undo_edit_request( @@ -390,8 +400,9 @@ async def undo_edit( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py index 055eb0da6ab7..b7f7ea619c11 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -41,10 +42,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -82,7 +79,7 @@ async def _publish_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_publish_request( @@ -98,8 +95,9 @@ async def _publish_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -125,6 +123,9 @@ async def begin_publish( ) -> AsyncLROPoller[None]: """Publish runbook draft. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -146,7 +147,7 @@ async def begin_publish( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -193,6 +194,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the content of runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -215,7 +219,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -231,8 +235,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,6 +263,9 @@ async def get( ) -> _models.Runbook: """Retrieve the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -280,7 +288,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) request = build_get_request( @@ -296,8 +304,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,6 +340,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -362,6 +374,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -391,6 +406,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -398,7 +416,8 @@ async def create_or_update( :param runbook_name: The runbook name. Required. :type runbook_name: str :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a model type or a IO type. Required. + a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -419,14 +438,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") @@ -447,8 +466,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,6 +506,9 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,6 +539,9 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -544,14 +570,17 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -572,14 +601,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookUpdateParameters") @@ -600,8 +629,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -628,6 +658,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the runbook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -650,7 +683,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -666,8 +699,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,6 +724,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Runbook"]: """Retrieve a list of runbooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -702,7 +739,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) error_map = { @@ -729,7 +766,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -745,8 +793,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runtime_environments_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runtime_environments_operations.py new file mode 100644 index 000000000000..8e2aea86166e --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runtime_environments_operations.py @@ -0,0 +1,615 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._runtime_environments_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_automation_account_request, + build_update_request, +) +from .._vendor import AutomationClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RuntimeEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`runtime_environments` 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") + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironmentUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters + :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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironmentUpdateParameters, IO], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Is either a + RuntimeEnvironmentUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters 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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeEnvironmentUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment + :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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironment, IO], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Is either a + RuntimeEnvironment type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment 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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeEnvironment") + + request = build_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> None: + """Delete the Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Get information about the Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RuntimeEnvironment"]: + """Retrieve a list of RuntimeEnvironments. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuntimeEnvironment or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.RuntimeEnvironment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuntimeEnvironmentListResult] = 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_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_automation_account.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("RuntimeEnvironmentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_automation_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py index 7a3e4d38c12e..02b2885b7fc3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +74,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +108,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +140,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +150,7 @@ async def create_or_update( :param schedule_name: The schedule name. Required. :type schedule_name: str :param parameters: The parameters supplied to the create or update schedule operation. Is - either a model type or a IO type. Required. + either a ScheduleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +171,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") @@ -193,8 +199,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,6 +240,9 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,6 +273,9 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -291,14 +304,17 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param schedule_name: The schedule name. Required. :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update schedule operation. Is either a + ScheduleUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -319,14 +335,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleUpdateParameters") @@ -347,8 +363,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +392,9 @@ async def get( ) -> _models.Schedule: """Retrieve the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -397,7 +417,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( @@ -413,8 +433,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,6 +462,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -463,7 +487,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -479,8 +503,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,6 +528,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Schedule"]: """Retrieve a list of schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -515,7 +543,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -542,7 +570,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -558,8 +597,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py index 5f715eec7678..0c8d5c4048a2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -32,10 +31,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ async def get_by_id( ) -> _models.SoftwareUpdateConfigurationMachineRun: """Get a single software update configuration machine run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -95,7 +93,7 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -112,8 +110,9 @@ async def get_by_id( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,6 +146,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: """Return list of software update configuration machine runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -178,7 +180,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -197,8 +199,9 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py index 2e5dfb1846ab..dba46665192d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._software_update_configuration_runs_operations import build_get_by_id_request, build_list_request from .._vendor import AutomationClientMixinABC -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]] @@ -67,6 +62,9 @@ async def get_by_id( ) -> _models.SoftwareUpdateConfigurationRun: """Get a single software update configuration Run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +90,7 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -109,8 +107,9 @@ async def get_by_id( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,6 +143,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationRunListResult: """Return list of software update configuration runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -175,7 +177,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -194,8 +196,9 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py index 38d44d4fb817..c41d6ed0ff62 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -34,10 +34,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -75,6 +71,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -109,6 +108,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -141,6 +143,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -148,7 +153,8 @@ async def create( :param software_update_configuration_name: The name of the software update configuration to be created. Required. :type software_update_configuration_name: str - :param parameters: Request body. Is either a model type or a IO type. Required. + :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO type. + Required. :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -171,14 +177,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") @@ -200,8 +206,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,6 +244,9 @@ async def get_by_name( ) -> _models.SoftwareUpdateConfiguration: """Get a single software update configuration by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +272,7 @@ async def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) request = build_get_by_name_request( @@ -279,8 +289,9 @@ async def get_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,6 +323,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """delete a specific software update configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -337,7 +351,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -354,8 +368,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -383,6 +398,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationListResult: """Get all software update configurations for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,7 +425,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -424,8 +442,9 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py index 4b0b4776ffe5..2cf9bb187ab4 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +74,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +108,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +140,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +150,7 @@ async def create_or_update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the create or update source control operation. Is - either a model type or a IO type. Required. + either a SourceControlCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +171,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") @@ -193,8 +199,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,6 +239,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +272,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -290,6 +303,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,7 +313,7 @@ async def update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the update source control operation. Is either a - model type or a IO type. Required. + SourceControlUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,14 +334,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlUpdateParameters") @@ -346,8 +362,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,7 +416,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -412,8 +432,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,6 +457,9 @@ async def get( ) -> _models.SourceControl: """Retrieve the source control identified by source control name. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,7 +482,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -474,8 +498,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,6 +527,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.SourceControl"]: """Retrieve a list of source controls. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,7 +544,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) error_map = { @@ -544,7 +572,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -560,8 +599,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py index 51cee98812a5..4739d98ac8e0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,10 +36,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -76,6 +73,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -110,6 +110,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -142,6 +145,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -151,7 +157,7 @@ async def create( :param source_control_sync_job_id: The source control sync job id. Required. :type source_control_sync_job_id: str :param parameters: The parameters supplied to the create source control sync job operation. Is - either a model type or a IO type. Required. + either a SourceControlSyncJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -172,14 +178,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") @@ -201,8 +207,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,6 +241,9 @@ async def get( ) -> _models.SourceControlSyncJobById: """Retrieve the source control sync job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -258,7 +268,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) request = build_get_request( @@ -275,8 +285,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,6 +319,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -326,7 +340,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) error_map = { @@ -355,7 +369,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -371,8 +396,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py index 42a2a6839152..7a126ecb5af6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -31,10 +31,6 @@ from ...operations._source_control_sync_job_streams_operations import build_get_request, build_list_by_sync_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ def list_by_sync_job( ) -> AsyncIterable["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -90,7 +89,7 @@ def list_by_sync_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) error_map = { @@ -120,7 +119,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -136,8 +146,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,6 +177,9 @@ async def get( ) -> _models.SourceControlSyncJobStreamById: """Retrieve a sync job stream identified by stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -192,7 +206,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +224,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py index 5ef85ee1ce1f..2ffaba6d3c2f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -30,10 +30,6 @@ from ...operations._statistics_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -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]] @@ -63,6 +59,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Statistics"]: """Retrieve the statistics for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/statisticsoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -77,7 +76,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) error_map = { @@ -105,7 +104,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -121,8 +131,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py index fabe9d8f9a29..425b6655a070 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +35,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -75,6 +71,9 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -105,6 +104,9 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -133,14 +135,17 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The parameters supplied to the create test job operation. Required. :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the create test job operation. Is either a + TestJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -161,14 +166,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestJobCreateParameters") @@ -189,8 +194,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,6 +223,9 @@ async def get( ) -> _models.TestJob: """Retrieve the test job for the specified runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -239,7 +248,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) request = build_get_request( @@ -255,8 +264,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,6 +293,9 @@ async def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -305,7 +318,7 @@ async def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -321,8 +334,9 @@ async def resume( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,6 +359,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -367,7 +384,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -383,8 +400,9 @@ async def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -407,6 +425,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -429,7 +450,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -445,8 +466,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py index 51075a4a0d03..c3833647b359 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -31,10 +31,6 @@ from ...operations._test_job_streams_operations import build_get_request, build_list_by_test_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ async def get( ) -> _models.JobStream: """Retrieve a test job stream of the test job identified by runbook name and stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +92,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +109,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,6 +143,9 @@ def list_by_test_job( ) -> AsyncIterable["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -159,7 +162,7 @@ def list_by_test_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -188,7 +191,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -204,8 +218,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py index 52a873ca2ef7..2959b2e36e07 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py @@ -6,8 +6,8 @@ # 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 ( @@ -30,10 +30,6 @@ from ...operations._usages_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -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]] @@ -63,6 +59,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Usage"]: """Retrieve the usage for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/usageoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -75,7 +74,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) error_map = { @@ -102,7 +101,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -118,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py index bb54df1bd302..0355d501f2c0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +74,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +108,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +140,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +150,7 @@ async def create_or_update( :param variable_name: The variable name. Required. :type variable_name: str :param parameters: The parameters supplied to the create or update variable operation. Is - either a model type or a IO type. Required. + either a VariableCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +171,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") @@ -193,8 +199,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,6 +239,9 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +272,9 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -290,14 +303,17 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param variable_name: The variable name. Required. :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update variable operation. Is either a + VariableUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,14 +334,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableUpdateParameters") @@ -346,8 +362,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +391,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,7 +416,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -412,8 +432,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,6 +457,9 @@ async def get( ) -> _models.Variable: """Retrieve the variable identified by variable name. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,7 +482,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) request = build_get_request( @@ -474,8 +498,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,6 +527,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Variable"]: """Retrieve a list of variables. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -514,7 +542,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) error_map = { @@ -541,7 +569,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -557,8 +596,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py index 4dea29785374..31e9e3750031 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -39,10 +40,6 @@ ) from .._vendor import AutomationClientMixinABC -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]] @@ -79,6 +76,9 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -109,6 +109,9 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,14 +140,17 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for watcher. Is either a Watcher type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.Watcher or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,16 +171,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Watcher") @@ -195,8 +199,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,6 +232,9 @@ async def get( ) -> _models.Watcher: """Retrieve the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -249,9 +257,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) request = build_get_request( @@ -267,8 +273,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +309,9 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -332,6 +342,9 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -360,14 +373,17 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -388,16 +404,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WatcherUpdateParameters") @@ -418,8 +432,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,6 +461,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the watcher by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -468,9 +486,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -486,8 +502,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -510,6 +527,9 @@ async def start( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -532,9 +552,7 @@ async def start( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -550,8 +568,9 @@ async def start( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,6 +593,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -596,9 +618,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -614,8 +634,9 @@ async def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,6 +659,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Watcher"]: """Retrieve a list of watchers. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -652,9 +676,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -682,7 +704,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -698,8 +731,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py index ef4c7b057bff..5ee2987189f7 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,10 +39,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +66,9 @@ def __init__(self, *args, **kwargs) -> None: async def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: """Generates a Uri for use in creating a webhook. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -89,7 +89,7 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_generate_uri_request( @@ -104,8 +104,9 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +133,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the webhook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +158,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -170,8 +174,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,6 +199,9 @@ async def get( ) -> _models.Webhook: """Retrieve the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -216,7 +224,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) request = build_get_request( @@ -232,8 +240,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,6 +276,9 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,6 +309,9 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -325,14 +340,17 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for webhook. Is either a + WebhookCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -353,14 +371,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") @@ -381,8 +399,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,6 +439,9 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -450,6 +472,9 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -478,14 +503,17 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -506,14 +534,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookUpdateParameters") @@ -534,8 +562,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -562,6 +591,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Webhook"]: """Retrieve a list of webhooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -576,7 +608,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) error_map = { @@ -604,7 +636,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -620,8 +663,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index c8280851cdf8..cbae8045179c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -43,6 +43,8 @@ from ._models_py3 import CredentialUpdateParameters from ._models_py3 import DeletedAutomationAccount from ._models_py3 import DeletedAutomationAccountListResult +from ._models_py3 import DeletedRunbook +from ._models_py3 import DeletedRunbookListResult from ._models_py3 import Dimension from ._models_py3 import DscCompilationJob from ._models_py3 import DscCompilationJobCreateParameters @@ -85,6 +87,7 @@ from ._models_py3 import JobCreateParameters from ._models_py3 import JobListResultV2 from ._models_py3 import JobNavigation +from ._models_py3 import JobRuntimeEnvironment from ._models_py3 import JobSchedule from ._models_py3 import JobScheduleCreateParameters from ._models_py3 import JobScheduleListResult @@ -110,6 +113,11 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import OperationPropertiesFormatServiceSpecification +from ._models_py3 import Package +from ._models_py3 import PackageCreateOrUpdateParameters +from ._models_py3 import PackageErrorInfo +from ._models_py3 import PackageListResult +from ._models_py3 import PackageUpdateParameters from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult from ._models_py3 import PrivateEndpointProperty @@ -132,6 +140,9 @@ from ._models_py3 import RunbookListResult from ._models_py3 import RunbookParameter from ._models_py3 import RunbookUpdateParameters +from ._models_py3 import RuntimeEnvironment +from ._models_py3 import RuntimeEnvironmentListResult +from ._models_py3 import RuntimeEnvironmentUpdateParameters from ._models_py3 import SUCScheduleProperties from ._models_py3 import Schedule from ._models_py3 import ScheduleAssociationProperty @@ -209,6 +220,7 @@ from ._automation_client_enums import LinuxUpdateClasses from ._automation_client_enums import ModuleProvisioningState from ._automation_client_enums import OperatingSystemType +from ._automation_client_enums import PackageProvisioningState from ._automation_client_enums import ProvisioningState from ._automation_client_enums import ResourceIdentityType from ._automation_client_enums import RunbookState @@ -265,6 +277,8 @@ "CredentialUpdateParameters", "DeletedAutomationAccount", "DeletedAutomationAccountListResult", + "DeletedRunbook", + "DeletedRunbookListResult", "Dimension", "DscCompilationJob", "DscCompilationJobCreateParameters", @@ -307,6 +321,7 @@ "JobCreateParameters", "JobListResultV2", "JobNavigation", + "JobRuntimeEnvironment", "JobSchedule", "JobScheduleCreateParameters", "JobScheduleListResult", @@ -332,6 +347,11 @@ "OperationDisplay", "OperationListResult", "OperationPropertiesFormatServiceSpecification", + "Package", + "PackageCreateOrUpdateParameters", + "PackageErrorInfo", + "PackageListResult", + "PackageUpdateParameters", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", "PrivateEndpointProperty", @@ -354,6 +374,9 @@ "RunbookListResult", "RunbookParameter", "RunbookUpdateParameters", + "RuntimeEnvironment", + "RuntimeEnvironmentListResult", + "RuntimeEnvironmentUpdateParameters", "SUCScheduleProperties", "Schedule", "ScheduleAssociationProperty", @@ -430,6 +453,7 @@ "LinuxUpdateClasses", "ModuleProvisioningState", "OperatingSystemType", + "PackageProvisioningState", "ProvisioningState", "ResourceIdentityType", "RunbookState", diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py index f1305838c80d..e4b437586560 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py @@ -141,6 +141,7 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_UNAVAILABLE = "ServiceUnavailable" GATEWAY_TIMEOUT = "GatewayTimeout" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" + CONTINUE_ENUM = "Continue" class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -219,6 +220,27 @@ class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LINUX = "Linux" +class PackageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the provisioning state of the Package.""" + + CREATED = "Created" + CREATING = "Creating" + STARTING_IMPORT_MODULE_RUNBOOK = "StartingImportModuleRunbook" + RUNNING_IMPORT_MODULE_RUNBOOK = "RunningImportModuleRunbook" + CONTENT_RETRIEVED = "ContentRetrieved" + CONTENT_DOWNLOADED = "ContentDownloaded" + CONTENT_VALIDATED = "ContentValidated" + CONNECTION_TYPE_IMPORTED = "ConnectionTypeImported" + CONTENT_STORED = "ContentStored" + MODULE_DATA_STORED = "ModuleDataStored" + ACTIVITIES_STORED = "ActivitiesStored" + MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the job.""" @@ -255,6 +277,7 @@ class RunbookTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): GRAPH_POWER_SHELL = "GraphPowerShell" PYTHON2 = "Python2" PYTHON3 = "Python3" + PYTHON = "Python" class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -279,8 +302,8 @@ class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): HOUR = "Hour" WEEK = "Week" MONTH = "Month" - #: The minimum allowed interval for Minute schedules is 15 minutes. MINUTE = "Minute" + """The minimum allowed interval for Minute schedules is 15 minutes.""" class SkuNameEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py index eab718b16728..4b8ee7cdecb7 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py @@ -76,8 +76,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -119,7 +119,9 @@ class ActivityListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of activities. :paramtype value: list[~azure.mgmt.automation.models.Activity] @@ -145,7 +147,7 @@ class ActivityOutputType(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the activity output type. :paramtype name: str @@ -218,8 +220,8 @@ def __init__( value_from_remaining_arguments: Optional[bool] = None, description: Optional[str] = None, validation_set: Optional[List["_models.ActivityParameterValidationSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the activity parameter. :paramtype name: str @@ -281,8 +283,12 @@ class ActivityParameterSet(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, parameters: Optional[List["_models.ActivityParameter"]] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + parameters: Optional[List["_models.ActivityParameter"]] = None, + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the activity parameter set. :paramtype name: str @@ -305,7 +311,7 @@ class ActivityParameterValidationSet(_serialization.Model): "member_value": {"key": "memberValue", "type": "str"}, } - def __init__(self, *, member_value: Optional[str] = None, **kwargs): + def __init__(self, *, member_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword member_value: Gets or sets the name of the activity parameter validation set member. :paramtype member_value: str @@ -338,8 +344,8 @@ def __init__( week_days: Optional[List[str]] = None, month_days: Optional[List[int]] = None, monthly_occurrences: Optional[List["_models.AdvancedScheduleMonthlyOccurrence"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword week_days: Days of the week that the job should execute on. :paramtype week_days: list[str] @@ -373,8 +379,12 @@ class AdvancedScheduleMonthlyOccurrence(_serialization.Model): } def __init__( - self, *, occurrence: Optional[int] = None, day: Optional[Union[str, "_models.ScheduleDay"]] = None, **kwargs - ): + self, + *, + occurrence: Optional[int] = None, + day: Optional[Union[str, "_models.ScheduleDay"]] = None, + **kwargs: Any + ) -> None: """ :keyword occurrence: Occurrence of the week within the month. Must be between 1 and 5. :paramtype occurrence: int @@ -415,8 +425,8 @@ def __init__( endpoint: Optional[str] = None, keys: Optional["_models.AgentRegistrationKeys"] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword dsc_meta_configuration: Gets or sets the dsc meta configuration. :paramtype dsc_meta_configuration: str @@ -448,7 +458,7 @@ class AgentRegistrationKeys(_serialization.Model): "secondary": {"key": "secondary", "type": "str"}, } - def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs): + def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs: Any) -> None: """ :keyword primary: Gets or sets the primary key. :paramtype primary: str @@ -478,7 +488,7 @@ class AgentRegistrationRegenerateKeyParameter(_serialization.Model): "key_name": {"key": "keyName", "type": "str"}, } - def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], **kwargs): + def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], **kwargs: Any) -> None: """ :keyword key_name: Gets or sets the agent registration key name - primary or secondary. Required. Known values are: "primary" and "secondary". @@ -489,52 +499,68 @@ def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], class Resource(_serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ @@ -542,21 +568,24 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ super().__init__(**kwargs) @@ -569,22 +598,27 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar etag: Gets or sets the etag of the resource. :vartype etag: str :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.automation.models.Identity - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar sku: Gets or sets the SKU of account. :vartype sku: ~azure.mgmt.automation.models.Sku :ivar last_modified_by: Gets or sets the last modified by. @@ -618,6 +652,7 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "state": {"readonly": True}, "creation_time": {"readonly": True}, "last_modified_time": {"readonly": True}, @@ -627,11 +662,11 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "etag": {"key": "etag", "type": "str"}, "identity": {"key": "identity", "type": "Identity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "sku": {"key": "properties.sku", "type": "Sku"}, "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, "state": {"key": "properties.state", "type": "str"}, @@ -651,8 +686,8 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a def __init__( self, *, + location: str, tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, etag: Optional[str] = None, identity: Optional["_models.Identity"] = None, sku: Optional["_models.Sku"] = None, @@ -663,12 +698,12 @@ def __init__( public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, automation_hybrid_service_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str @@ -699,7 +734,6 @@ def __init__( super().__init__(tags=tags, location=location, **kwargs) self.etag = etag self.identity = identity - self.system_data = None self.sku = sku self.last_modified_by = last_modified_by self.state = None @@ -757,8 +791,8 @@ def __init__( encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -805,8 +839,12 @@ class AutomationAccountListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AutomationAccount"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AutomationAccount"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets list of accounts. :paramtype value: list[~azure.mgmt.automation.models.AutomationAccount] @@ -862,8 +900,8 @@ def __init__( encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -918,8 +956,8 @@ def __init__( scope: Optional[List[str]] = None, locations: Optional[List[str]] = None, tag_settings: Optional["_models.TagSettingsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: List of Subscription or Resource Group ARM Ids. :paramtype scope: list[str] @@ -935,31 +973,39 @@ def __init__( class ProxyResource(Resource): - """ARM proxy resource. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -969,12 +1015,17 @@ class Certificate(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar thumbprint: Gets the thumbprint of the certificate. :vartype thumbprint: str :ivar expiry_time: Gets the expiry time of the certificate. @@ -993,6 +1044,7 @@ class Certificate(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "thumbprint": {"readonly": True}, "expiry_time": {"readonly": True}, "is_exportable": {"readonly": True}, @@ -1004,6 +1056,7 @@ class Certificate(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "thumbprint": {"key": "properties.thumbprint", "type": "str"}, "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, "is_exportable": {"key": "properties.isExportable", "type": "bool"}, @@ -1012,7 +1065,7 @@ class Certificate(ProxyResource): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: Gets or sets the description. :paramtype description: str @@ -1064,8 +1117,8 @@ def __init__( description: Optional[str] = None, thumbprint: Optional[str] = None, is_exportable: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the certificate. Required. :paramtype name: str @@ -1101,8 +1154,8 @@ class CertificateListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of certificates. :paramtype value: list[~azure.mgmt.automation.models.Certificate] @@ -1128,7 +1181,7 @@ class CertificateUpdateParameters(_serialization.Model): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the certificate. :paramtype name: str @@ -1145,12 +1198,17 @@ class Connection(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar connection_type: Gets or sets the connectionType of the connection. :vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty :ivar field_definition_values: Gets the field definition values of the connection. @@ -1167,6 +1225,7 @@ class Connection(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "field_definition_values": {"readonly": True}, "creation_time": {"readonly": True}, "last_modified_time": {"readonly": True}, @@ -1176,6 +1235,7 @@ class Connection(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "connection_type": {"key": "properties.connectionType", "type": "ConnectionTypeAssociationProperty"}, "field_definition_values": {"key": "properties.fieldDefinitionValues", "type": "{str}"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, @@ -1188,8 +1248,8 @@ def __init__( *, connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_type: Gets or sets the connectionType of the connection. :paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty @@ -1238,8 +1298,8 @@ def __init__( connection_type: "_models.ConnectionTypeAssociationProperty", description: Optional[str] = None, field_definition_values: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection. Required. :paramtype name: str @@ -1273,8 +1333,8 @@ class ConnectionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of connection. :paramtype value: list[~azure.mgmt.automation.models.Connection] @@ -1334,8 +1394,8 @@ def __init__( is_global: Optional[bool] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global. :paramtype is_global: bool @@ -1366,7 +1426,7 @@ class ConnectionTypeAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the connection type. :paramtype name: str @@ -1405,8 +1465,8 @@ def __init__( name: str, field_definitions: Dict[str, "_models.FieldDefinition"], is_global: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection type. Required. :paramtype name: str @@ -1437,8 +1497,8 @@ class ConnectionTypeListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of connection types. :paramtype value: list[~azure.mgmt.automation.models.ConnectionType] @@ -1473,8 +1533,8 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, field_definition_values: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection. :paramtype name: str @@ -1510,7 +1570,7 @@ class ContentHash(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, algorithm: str, value: str, **kwargs): + def __init__(self, *, algorithm: str, value: str, **kwargs: Any) -> None: """ :keyword algorithm: Gets or sets the content hash algorithm used to hash the content. Required. :paramtype algorithm: str @@ -1525,7 +1585,7 @@ def __init__(self, *, algorithm: str, value: str, **kwargs): class ContentLink(_serialization.Model): """Definition of the content link. - :ivar uri: Gets or sets the uri of the runbook content. + :ivar uri: Gets or sets the uri of content. :vartype uri: str :ivar content_hash: Gets or sets the hash. :vartype content_hash: ~azure.mgmt.automation.models.ContentHash @@ -1545,10 +1605,10 @@ def __init__( uri: Optional[str] = None, content_hash: Optional["_models.ContentHash"] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword uri: Gets or sets the uri of the runbook content. + :keyword uri: Gets or sets the uri of content. :paramtype uri: str :keyword content_hash: Gets or sets the hash. :paramtype content_hash: ~azure.mgmt.automation.models.ContentHash @@ -1589,8 +1649,8 @@ def __init__( type: Optional[Union[str, "_models.ContentSourceType"]] = None, value: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hash: Gets or sets the hash. :paramtype hash: ~azure.mgmt.automation.models.ContentHash @@ -1615,12 +1675,17 @@ class Credential(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar user_name: Gets the user name of the credential. :vartype user_name: str :ivar creation_time: Gets the creation time. @@ -1635,6 +1700,7 @@ class Credential(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "user_name": {"readonly": True}, "creation_time": {"readonly": True}, "last_modified_time": {"readonly": True}, @@ -1644,13 +1710,14 @@ class Credential(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "user_name": {"key": "properties.userName", "type": "str"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: Gets or sets the description. :paramtype description: str @@ -1690,7 +1757,9 @@ class CredentialCreateOrUpdateParameters(_serialization.Model): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, name: str, user_name: str, password: str, description: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, user_name: str, password: str, description: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the credential. Required. :paramtype name: str @@ -1723,8 +1792,8 @@ class CredentialListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of credentials. :paramtype value: list[~azure.mgmt.automation.models.Credential] @@ -1763,8 +1832,8 @@ def __init__( user_name: Optional[str] = None, password: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the credential. :paramtype name: str @@ -1830,8 +1899,8 @@ def __init__( automation_account_resource_id: Optional[str] = None, automation_account_id: Optional[str] = None, location_properties_location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The resource id. :paramtype id: str @@ -1870,7 +1939,7 @@ class DeletedAutomationAccountListResult(_serialization.Model): "value": {"key": "value", "type": "[DeletedAutomationAccount]"}, } - def __init__(self, *, value: Optional[List["_models.DeletedAutomationAccount"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeletedAutomationAccount"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets the list of deleted automation accounts. :paramtype value: list[~azure.mgmt.automation.models.DeletedAutomationAccount] @@ -1879,6 +1948,115 @@ def __init__(self, *, value: Optional[List["_models.DeletedAutomationAccount"]] self.value = value +class DeletedRunbook(_serialization.Model): + """Definition of deleted runbook. + + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar runbook_id: Gets or sets the Runbook Id. + :vartype runbook_id: str + :ivar runbook_type: Type of the runbook. + :vartype runbook_type: str + :ivar runtime: Gets or sets runtime of the runbook. + :vartype runtime: str + :ivar runtime_environment: Environment of the runbook. + :vartype runtime_environment: str + :ivar creation_time: Gets or sets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar deletion_time: Gets or sets the last modified time. + :vartype deletion_time: ~datetime.datetime + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "runbook_id": {"key": "properties.runbookId", "type": "str"}, + "runbook_type": {"key": "properties.runbookType", "type": "str"}, + "runtime": {"key": "properties.runtime", "type": "str"}, + "runtime_environment": {"key": "properties.runtimeEnvironment", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + "deletion_time": {"key": "properties.deletionTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + location: Optional[str] = None, + runbook_id: Optional[str] = None, + runbook_type: Optional[str] = None, + runtime: Optional[str] = None, + runtime_environment: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + deletion_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The resource id. + :paramtype id: str + :keyword name: Gets or sets name of the resource. + :paramtype name: str + :keyword location: Gets or sets the location of the resource. + :paramtype location: str + :keyword runbook_id: Gets or sets the Runbook Id. + :paramtype runbook_id: str + :keyword runbook_type: Type of the runbook. + :paramtype runbook_type: str + :keyword runtime: Gets or sets runtime of the runbook. + :paramtype runtime: str + :keyword runtime_environment: Environment of the runbook. + :paramtype runtime_environment: str + :keyword creation_time: Gets or sets the creation time. + :paramtype creation_time: ~datetime.datetime + :keyword deletion_time: Gets or sets the last modified time. + :paramtype deletion_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.location = location + self.runbook_id = runbook_id + self.runbook_type = runbook_type + self.runtime = runtime + self.runtime_environment = runtime_environment + self.creation_time = creation_time + self.deletion_time = deletion_time + + +class DeletedRunbookListResult(_serialization.Model): + """The response model for the list deleted runbook. + + :ivar value: List of deleted runbooks in automation account. + :vartype value: list[~azure.mgmt.automation.models.DeletedRunbook] + :ivar next_link: Gets or sets the next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[DeletedRunbook]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.DeletedRunbook"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of deleted runbooks in automation account. + :paramtype value: list[~azure.mgmt.automation.models.DeletedRunbook] + :keyword next_link: Gets or sets the next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class Dimension(_serialization.Model): """Dimension of the metric. @@ -1893,7 +2071,7 @@ class Dimension(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the dimension. :paramtype name: str @@ -1910,12 +2088,17 @@ class DscCompilationJob(ProxyResource): # pylint: disable=too-many-instance-att Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar configuration: Gets or sets the configuration. :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty :ivar started_by: Gets the compilation job started by. @@ -1954,6 +2137,7 @@ class DscCompilationJob(ProxyResource): # pylint: disable=too-many-instance-att "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "started_by": {"readonly": True}, "job_id": {"readonly": True}, "creation_time": {"readonly": True}, @@ -1968,6 +2152,7 @@ class DscCompilationJob(ProxyResource): # pylint: disable=too-many-instance-att "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, "started_by": {"key": "properties.startedBy", "type": "str"}, "job_id": {"key": "properties.jobId", "type": "str"}, @@ -1993,8 +2178,8 @@ def __init__( status: Optional[Union[str, "_models.JobStatus"]] = None, status_details: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration: Gets or sets the configuration. :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty @@ -2072,8 +2257,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, parameters: Optional[Dict[str, str]] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2113,8 +2298,12 @@ class DscCompilationJobListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DscCompilationJob"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DscCompilationJob"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of Dsc Compilation jobs. :paramtype value: list[~azure.mgmt.automation.models.DscCompilationJob] @@ -2131,15 +2320,22 @@ class DscConfiguration(TrackedResource): # pylint: disable=too-many-instance-at Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar etag: Gets or sets the etag of the resource. :vartype etag: str @@ -2171,12 +2367,15 @@ class DscConfiguration(TrackedResource): # pylint: disable=too-many-instance-at "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "etag": {"key": "etag", "type": "str"}, @@ -2195,8 +2394,8 @@ class DscConfiguration(TrackedResource): # pylint: disable=too-many-instance-at def __init__( self, *, + location: str, tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, etag: Optional[str] = None, provisioning_state: Optional[Literal["Succeeded"]] = None, job_count: Optional[int] = None, @@ -2208,12 +2407,12 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, node_configuration_count: Optional[int] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str @@ -2265,7 +2464,7 @@ class DscConfigurationAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the Dsc configuration. :paramtype name: str @@ -2323,8 +2522,8 @@ def __init__( log_progress: Optional[bool] = None, parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2377,8 +2576,8 @@ def __init__( value: Optional[List["_models.DscConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of configurations. :paramtype value: list[~azure.mgmt.automation.models.DscConfiguration] @@ -2421,8 +2620,8 @@ def __init__( is_mandatory: Optional[bool] = None, position: Optional[int] = None, default_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the type of the parameter. :paramtype type: str @@ -2480,8 +2679,8 @@ def __init__( source: Optional["_models.ContentSource"] = None, parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2551,8 +2750,8 @@ def __init__( certificate_id: Optional[str] = None, refresh_frequency_mins: Optional[int] = None, allow_module_overwrite: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. @@ -2590,12 +2789,17 @@ class DscNode(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar last_seen: Gets or sets the last seen time of the node. :vartype last_seen: ~datetime.datetime :ivar registration_time: Gets or sets the registration time of the node. @@ -2624,12 +2828,14 @@ class DscNode(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "last_seen": {"key": "properties.lastSeen", "type": "iso-8601"}, "registration_time": {"key": "properties.registrationTime", "type": "iso-8601"}, "ip": {"key": "properties.ip", "type": "str"}, @@ -2658,8 +2864,8 @@ def __init__( total_count: Optional[int] = None, extension_handler: Optional[List["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, name_properties_node_configuration_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword last_seen: Gets or sets the last seen time of the node. :paramtype last_seen: ~datetime.datetime @@ -2702,12 +2908,17 @@ class DscNodeConfiguration(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar last_modified_time: Gets or sets the last modified time. :vartype last_modified_time: ~datetime.datetime :ivar creation_time: Gets or sets creation time. @@ -2727,12 +2938,14 @@ class DscNodeConfiguration(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, @@ -2750,8 +2963,8 @@ def __init__( source: Optional[str] = None, node_count: Optional[int] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword last_modified_time: Gets or sets the last modified time. :paramtype last_modified_time: ~datetime.datetime @@ -2808,8 +3021,8 @@ def __init__( source: Optional["_models.ContentSource"] = None, configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the node configuration. :paramtype name: str @@ -2854,8 +3067,8 @@ def __init__( value: Optional[List["_models.DscNodeConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of Dsc node configurations. :paramtype value: list[~azure.mgmt.automation.models.DscNodeConfiguration] @@ -2884,7 +3097,7 @@ class DscNodeExtensionHandlerAssociationProperty(_serialization.Model): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the extension handler. :paramtype name: str @@ -2919,8 +3132,8 @@ def __init__( value: Optional[List["_models.DscNode"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of dsc nodes. :paramtype value: list[~azure.mgmt.automation.models.DscNode] @@ -3023,8 +3236,8 @@ def __init__( i_pv6_addresses: Optional[List[str]] = None, number_of_resources: Optional[int] = None, raw_errors: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword end_time: Gets or sets the end time of the node report. :paramtype end_time: ~datetime.datetime @@ -3103,8 +3316,8 @@ class DscNodeReportListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of dsc node reports. :paramtype value: list[~azure.mgmt.automation.models.DscNodeReport] @@ -3135,8 +3348,8 @@ def __init__( *, node_id: Optional[str] = None, properties: Optional["_models.DscNodeUpdateParametersProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword node_id: Gets or sets the id of the dsc node. :paramtype node_id: str @@ -3159,7 +3372,7 @@ class DscNodeUpdateParametersProperties(_serialization.Model): "name": {"key": "nodeConfiguration.name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the dsc node configuration. :paramtype name: str @@ -3203,8 +3416,8 @@ def __init__( error_message: Optional[str] = None, locale: Optional[str] = None, error_details: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error_source: Gets or sets the source of the error. :paramtype error_source: str @@ -3280,8 +3493,8 @@ def __init__( status: Optional[str] = None, duration_in_seconds: Optional[float] = None, start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Gets or sets the ID of the resource. :paramtype resource_id: str @@ -3329,7 +3542,7 @@ class DscReportResourceNavigation(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_id: Gets or sets the ID of the resource to navigate to. :paramtype resource_id: str @@ -3362,8 +3575,8 @@ def __init__( key_vault_properties: Optional["_models.KeyVaultProperties"] = None, key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None, identity: Optional["_models.EncryptionPropertiesIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Key vault properties. :paramtype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties @@ -3392,7 +3605,7 @@ class EncryptionPropertiesIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "object"}, } - def __init__(self, *, user_assigned_identity: Optional[JSON] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user identity used for CMK. It will be an ARM resource id in the form: @@ -3417,7 +3630,7 @@ class ErrorResponse(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code. :paramtype code: str @@ -3452,7 +3665,9 @@ class FieldDefinition(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: str, is_encrypted: Optional[bool] = None, is_optional: Optional[bool] = None, **kwargs): + def __init__( + self, *, type: str, is_encrypted: Optional[bool] = None, is_optional: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword is_encrypted: Gets or sets the isEncrypted flag of the connection field definition. :paramtype is_encrypted: bool @@ -3486,8 +3701,8 @@ def __init__( *, raw_content: Optional["_models.RawGraphicalRunbookContent"] = None, graph_runbook_json: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword raw_content: Raw graphical Runbook content. :paramtype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent @@ -3499,19 +3714,28 @@ def __init__( self.graph_runbook_json = graph_runbook_json -class HybridRunbookWorker(Resource): +class HybridRunbookWorker(TrackedResource): # pylint: disable=too-many-instance-attributes """Definition of hybrid runbook worker. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Resource system metadata. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar ip: Gets or sets the assigned machine IP address. :vartype ip: str :ivar registered_date_time: Gets or sets the registration time of the worker machine. @@ -3531,6 +3755,7 @@ class HybridRunbookWorker(Resource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { @@ -3538,6 +3763,8 @@ class HybridRunbookWorker(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "ip": {"key": "properties.ip", "type": "str"}, "registered_date_time": {"key": "properties.registeredDateTime", "type": "iso-8601"}, "last_seen_date_time": {"key": "properties.lastSeenDateTime", "type": "iso-8601"}, @@ -3549,15 +3776,21 @@ class HybridRunbookWorker(Resource): def __init__( self, *, + location: str, + tags: Optional[Dict[str, str]] = None, ip: Optional[str] = None, registered_date_time: Optional[datetime.datetime] = None, last_seen_date_time: Optional[datetime.datetime] = None, vm_resource_id: Optional[str] = None, worker_type: Optional[Union[str, "_models.WorkerType"]] = None, worker_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword ip: Gets or sets the assigned machine IP address. :paramtype ip: str :keyword registered_date_time: Gets or sets the registration time of the worker machine. @@ -3571,8 +3804,7 @@ def __init__( :keyword worker_name: Name of the HybridWorker. :paramtype worker_name: str """ - super().__init__(**kwargs) - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) self.ip = ip self.registered_date_time = registered_date_time self.last_seen_date_time = last_seen_date_time @@ -3584,42 +3816,55 @@ def __init__( class HybridRunbookWorkerCreateParameters(_serialization.Model): """The parameters supplied to the create hybrid runbook worker operation. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar name: Gets or sets the name of the resource. :vartype name: str :ivar vm_resource_id: Azure Resource Manager Id for a virtual machine. :vartype vm_resource_id: str """ + _validation = { + "name": {"readonly": True}, + } + _attribute_map = { "name": {"key": "name", "type": "str"}, "vm_resource_id": {"key": "properties.vmResourceId", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, vm_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, vm_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: Gets or sets the name of the resource. - :paramtype name: str :keyword vm_resource_id: Azure Resource Manager Id for a virtual machine. :paramtype vm_resource_id: str """ super().__init__(**kwargs) - self.name = name + self.name = None self.vm_resource_id = vm_resource_id -class HybridRunbookWorkerGroup(Resource): +class HybridRunbookWorkerGroup(TrackedResource): """Definition of hybrid runbook worker group. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Resource system metadata. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". :vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum :ivar credential: Sets the credential of a worker group. @@ -3631,6 +3876,7 @@ class HybridRunbookWorkerGroup(Resource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { @@ -3638,6 +3884,8 @@ class HybridRunbookWorkerGroup(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "group_type": {"key": "properties.groupType", "type": "str"}, "credential": {"key": "properties.credential", "type": "RunAsCredentialAssociationProperty"}, } @@ -3645,18 +3893,23 @@ class HybridRunbookWorkerGroup(Resource): def __init__( self, *, + location: str, + tags: Optional[Dict[str, str]] = None, group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". :paramtype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum :keyword credential: Sets the credential of a worker group. :paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty """ - super().__init__(**kwargs) - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) self.group_type = group_type self.credential = credential @@ -3680,8 +3933,8 @@ def __init__( *, name: Optional[str] = None, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -3712,8 +3965,8 @@ def __init__( *, value: Optional[List["_models.HybridRunbookWorkerGroup"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of hybrid runbook worker groups. :paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] @@ -3736,7 +3989,7 @@ class HybridRunbookWorkerMoveParameters(_serialization.Model): "hybrid_runbook_worker_group_name": {"key": "hybridRunbookWorkerGroupName", "type": "str"}, } - def __init__(self, *, hybrid_runbook_worker_group_name: Optional[str] = None, **kwargs): + def __init__(self, *, hybrid_runbook_worker_group_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group. :paramtype hybrid_runbook_worker_group_name: str @@ -3760,8 +4013,12 @@ class HybridRunbookWorkersListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.HybridRunbookWorker"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.HybridRunbookWorker"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of hybrid runbook workers. :paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorker] @@ -3778,7 +4035,7 @@ class Identity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of resource identity. + :ivar principal_id: The principal ID of resource identity. The value must be an UUID. :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str @@ -3809,8 +4066,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentitiesProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -3833,12 +4090,17 @@ class Job(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar runbook: Gets or sets the runbook. :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty :ivar started_by: Gets or sets the job started by. @@ -3846,6 +4108,8 @@ class Job(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be executed. :vartype run_on: str + :ivar job_runtime_environment: Runtime Environment Property. + :vartype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment :ivar job_id: Gets or sets the id of the job. :vartype job_id: str :ivar creation_time: Gets or sets the creation time of the job. @@ -3877,15 +4141,18 @@ class Job(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, "started_by": {"key": "properties.startedBy", "type": "str"}, "run_on": {"key": "properties.runOn", "type": "str"}, + "job_runtime_environment": {"key": "properties.jobRuntimeEnvironment", "type": "JobRuntimeEnvironment"}, "job_id": {"key": "properties.jobId", "type": "str"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, "status": {"key": "properties.status", "type": "str"}, @@ -3905,6 +4172,7 @@ def __init__( runbook: Optional["_models.RunbookAssociationProperty"] = None, started_by: Optional[str] = None, run_on: Optional[str] = None, + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = None, job_id: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, status: Optional[Union[str, "_models.JobStatus"]] = None, @@ -3916,8 +4184,8 @@ def __init__( last_status_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, str]] = None, provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword runbook: Gets or sets the runbook. :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty @@ -3926,6 +4194,8 @@ def __init__( :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be executed. :paramtype run_on: str + :keyword job_runtime_environment: Runtime Environment Property. + :paramtype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment :keyword job_id: Gets or sets the id of the job. :paramtype job_id: str :keyword creation_time: Gets or sets the creation time of the job. @@ -3956,6 +4226,7 @@ def __init__( self.runbook = runbook self.started_by = started_by self.run_on = run_on + self.job_runtime_environment = job_runtime_environment self.job_id = job_id self.creation_time = creation_time self.status = status @@ -3974,16 +4245,23 @@ class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-att Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar runbook: The runbook association. :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty :ivar job_id: The id of the job. :vartype job_id: str + :ivar started_by: Gets or sets the job started by. + :vartype started_by: str :ivar creation_time: The creation time of the job. :vartype creation_time: ~datetime.datetime :ivar status: The status of the job. Known values are: "New", "Activating", "Running", @@ -3998,6 +4276,8 @@ class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-att :vartype last_modified_time: ~datetime.datetime :ivar provisioning_state: The provisioning state of a resource. :vartype provisioning_state: str + :ivar job_runtime_environment: Runtime Environment Property. + :vartype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment :ivar run_on: Specifies the runOn group name where the job was executed. :vartype run_on: str """ @@ -4006,8 +4286,10 @@ class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-att "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "runbook": {"readonly": True}, "job_id": {"readonly": True}, + "started_by": {"readonly": True}, "creation_time": {"readonly": True}, "status": {"readonly": True}, "start_time": {"readonly": True}, @@ -4020,31 +4302,44 @@ class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-att "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, "job_id": {"key": "properties.jobId", "type": "str"}, + "started_by": {"key": "properties.startedBy", "type": "str"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, "status": {"key": "properties.status", "type": "str"}, "start_time": {"key": "properties.startTime", "type": "iso-8601"}, "end_time": {"key": "properties.endTime", "type": "iso-8601"}, "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "job_runtime_environment": {"key": "properties.jobRuntimeEnvironment", "type": "JobRuntimeEnvironment"}, "run_on": {"key": "properties.runOn", "type": "str"}, } - def __init__(self, *, run_on: Optional[str] = None, **kwargs): + def __init__( + self, + *, + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = None, + run_on: Optional[str] = None, + **kwargs: Any + ) -> None: """ + :keyword job_runtime_environment: Runtime Environment Property. + :paramtype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment :keyword run_on: Specifies the runOn group name where the job was executed. :paramtype run_on: str """ super().__init__(**kwargs) self.runbook = None self.job_id = None + self.started_by = None self.creation_time = None self.status = None self.start_time = None self.end_time = None self.last_modified_time = None self.provisioning_state = None + self.job_runtime_environment = job_runtime_environment self.run_on = run_on @@ -4072,8 +4367,8 @@ def __init__( runbook: Optional["_models.RunbookAssociationProperty"] = None, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword runbook: Gets or sets the runbook. :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty @@ -4109,7 +4404,7 @@ class JobListResultV2(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobCollectionItem"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobCollectionItem"]] = None, **kwargs: Any) -> None: """ :keyword value: List of jobs. :paramtype value: list[~azure.mgmt.automation.models.JobCollectionItem] @@ -4136,12 +4431,32 @@ class JobNavigation(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None +class JobRuntimeEnvironment(_serialization.Model): + """The runbook property associated with the entity. + + :ivar runtime_environment_name: Name of Runtime Environment. + :vartype runtime_environment_name: str + """ + + _attribute_map = { + "runtime_environment_name": {"key": "runtimeEnvironmentName", "type": "str"}, + } + + def __init__(self, *, runtime_environment_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword runtime_environment_name: Name of Runtime Environment. + :paramtype runtime_environment_name: str + """ + super().__init__(**kwargs) + self.runtime_environment_name = runtime_environment_name + + class JobSchedule(_serialization.Model): """Definition of the job schedule. @@ -4190,8 +4505,8 @@ def __init__( runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword job_schedule_id: Gets or sets the id of job schedule. :paramtype job_schedule_id: str @@ -4249,8 +4564,8 @@ def __init__( runbook: "_models.RunbookAssociationProperty", run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword schedule: Gets or sets the schedule. Required. :paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty @@ -4283,8 +4598,8 @@ class JobScheduleListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of job schedules. :paramtype value: list[~azure.mgmt.automation.models.JobSchedule] @@ -4336,8 +4651,8 @@ def __init__( stream_text: Optional[str] = None, summary: Optional[str] = None, value: Optional[Dict[str, JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -4379,7 +4694,9 @@ class JobStreamListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: A list of job streams. :paramtype value: list[~azure.mgmt.automation.models.JobStream] @@ -4416,7 +4733,7 @@ class Key(_serialization.Model): "value": {"key": "Value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.key_name = None @@ -4435,7 +4752,7 @@ class KeyListResult(_serialization.Model): "keys": {"key": "keys", "type": "[Key]"}, } - def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs): + def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs: Any) -> None: """ :keyword keys: Lists the automation keys. :paramtype keys: list[~azure.mgmt.automation.models.Key] @@ -4467,8 +4784,8 @@ def __init__( keyvault_uri: Optional[str] = None, key_name: Optional[str] = None, key_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword keyvault_uri: The URI of the key vault key used to encrypt data. :paramtype keyvault_uri: str @@ -4500,7 +4817,7 @@ class LinkedWorkspace(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -4535,8 +4852,8 @@ def __init__( excluded_package_name_masks: Optional[List[str]] = None, included_package_name_masks: Optional[List[str]] = None, reboot_setting: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword included_package_classifications: Update classifications included in the software update configuration. Known values are: "Unclassified", "Critical", "Security", and "Other". @@ -4579,8 +4896,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the specification. :paramtype name: str @@ -4630,8 +4947,8 @@ def __init__( unit: Optional[str] = None, aggregation_type: Optional[str] = None, dimensions: Optional[List["_models.Dimension"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the metric. :paramtype name: str @@ -4660,15 +4977,22 @@ class Module(TrackedResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar etag: Gets or sets the etag of the resource. :vartype etag: str @@ -4704,12 +5028,15 @@ class Module(TrackedResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "etag": {"key": "etag", "type": "str"}, @@ -4729,8 +5056,8 @@ class Module(TrackedResource): # pylint: disable=too-many-instance-attributes def __init__( self, *, + location: str, tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, etag: Optional[str] = None, is_global: Optional[bool] = None, version: Optional[str] = None, @@ -4743,12 +5070,12 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, is_composite: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str @@ -4827,8 +5154,8 @@ def __init__( name: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -4860,7 +5187,7 @@ class ModuleErrorInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Gets or sets the error code. :paramtype code: str @@ -4886,7 +5213,9 @@ class ModuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of modules. :paramtype value: list[~azure.mgmt.automation.models.Module] @@ -4925,8 +5254,8 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, content_link: Optional["_models.ContentLink"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -4959,8 +5288,8 @@ class NodeCount(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.NodeCountProperties"] = None, **kwargs - ): + self, *, name: Optional[str] = None, properties: Optional["_models.NodeCountProperties"] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets the name of a count type. :paramtype name: str @@ -4983,7 +5312,7 @@ class NodeCountProperties(_serialization.Model): "count": {"key": "count", "type": "int"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Gets the count for the name. :paramtype count: int @@ -5007,8 +5336,8 @@ class NodeCounts(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs - ): + self, *, value: Optional[List["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets an array of counts. :paramtype value: list[~azure.mgmt.automation.models.NodeCount] @@ -5034,7 +5363,9 @@ class NonAzureQueryProperties(_serialization.Model): "workspace_id": {"key": "workspaceId", "type": "str"}, } - def __init__(self, *, function_alias: Optional[str] = None, workspace_id: Optional[str] = None, **kwargs): + def __init__( + self, *, function_alias: Optional[str] = None, workspace_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword function_alias: Log Analytics Saved Search name. :paramtype function_alias: str @@ -5077,8 +5408,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, service_specification: Optional["_models.OperationPropertiesFormatServiceSpecification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -5124,8 +5455,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Automation. :paramtype provider: str @@ -5154,7 +5485,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - 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 Automation operations supported by the Automation resource provider. :paramtype value: list[~azure.mgmt.automation.models.Operation] @@ -5182,8 +5513,8 @@ def __init__( *, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, log_specifications: Optional[List["_models.LogSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_specifications: Operation service specification. :paramtype metric_specifications: list[~azure.mgmt.automation.models.MetricSpecification] @@ -5195,17 +5526,252 @@ def __init__( self.log_specifications = log_specifications +class Package(TrackedResource): # pylint: disable=too-many-instance-attributes + """Definition of the Package type. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar default: Gets or sets the isGlobal flag of the package. + :vartype default: bool + :ivar version: Gets or sets the version of the Package. + :vartype version: str + :ivar size_in_bytes: Gets or sets the size in bytes of the Package. + :vartype size_in_bytes: int + :ivar provisioning_state: Gets or sets the provisioning state of the Package. Known values are: + "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", + "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", + "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", + "Succeeded", "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.PackageProvisioningState + :ivar content_link: Gets or sets the contentLink of the Package. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + :ivar error: Gets or sets the error info of the Package. + :vartype error: ~azure.mgmt.automation.models.PackageErrorInfo + :ivar all_of: Metadata pertaining to creation and last modification of the resource. + :vartype all_of: ~azure.mgmt.automation.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "all_of": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "default": {"key": "properties.default", "type": "bool"}, + "version": {"key": "properties.version", "type": "str"}, + "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, + "error": {"key": "properties.error", "type": "PackageErrorInfo"}, + "all_of": {"key": "properties.allOf", "type": "SystemData"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + default: Optional[bool] = None, + version: Optional[str] = None, + size_in_bytes: Optional[int] = None, + content_link: Optional["_models.ContentLink"] = None, + error: Optional["_models.PackageErrorInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword default: Gets or sets the isGlobal flag of the package. + :paramtype default: bool + :keyword version: Gets or sets the version of the Package. + :paramtype version: str + :keyword size_in_bytes: Gets or sets the size in bytes of the Package. + :paramtype size_in_bytes: int + :keyword content_link: Gets or sets the contentLink of the Package. + :paramtype content_link: ~azure.mgmt.automation.models.ContentLink + :keyword error: Gets or sets the error info of the Package. + :paramtype error: ~azure.mgmt.automation.models.PackageErrorInfo + """ + super().__init__(tags=tags, location=location, **kwargs) + self.default = default + self.version = version + self.size_in_bytes = size_in_bytes + self.provisioning_state = None + self.content_link = content_link + self.error = error + self.all_of = None + + +class PackageCreateOrUpdateParameters(_serialization.Model): + """The parameters supplied to the create or update package operation. + + All required parameters must be populated in order to send to Azure. + + :ivar all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :vartype all_of: ~azure.mgmt.automation.models.TrackedResource + :ivar content_link: Gets or sets the package content link. Required. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + _validation = { + "content_link": {"required": True}, + } + + _attribute_map = { + "all_of": {"key": "allOf", "type": "TrackedResource"}, + "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, + } + + def __init__( + self, *, content_link: "_models.ContentLink", all_of: Optional["_models.TrackedResource"] = None, **kwargs: Any + ) -> None: + """ + :keyword all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :paramtype all_of: ~azure.mgmt.automation.models.TrackedResource + :keyword content_link: Gets or sets the package content link. Required. + :paramtype content_link: ~azure.mgmt.automation.models.ContentLink + """ + super().__init__(**kwargs) + self.all_of = all_of + self.content_link = content_link + + +class PackageErrorInfo(_serialization.Model): + """Definition of the package error info type. + + :ivar code: Package import error code. + :vartype code: str + :ivar message: Package import error message. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: Package import error code. + :paramtype code: str + :keyword message: Package import error message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class PackageListResult(_serialization.Model): + """The response model for the list runtime environments operation. + + :ivar value: list of the Packages of the runtime environment. + :vartype value: list[~azure.mgmt.automation.models.Package] + :ivar next_link: Gets the next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Package]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Package"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: list of the Packages of the runtime environment. + :paramtype value: list[~azure.mgmt.automation.models.Package] + :keyword next_link: Gets the next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PackageUpdateParameters(_serialization.Model): + """The parameters supplied to the update package operation. + + :ivar all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :vartype all_of: ~azure.mgmt.automation.models.TrackedResource + :ivar content_link: Gets or sets the package content link. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + _attribute_map = { + "all_of": {"key": "allOf", "type": "TrackedResource"}, + "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, + } + + def __init__( + self, + *, + all_of: Optional["_models.TrackedResource"] = None, + content_link: Optional["_models.ContentLink"] = None, + **kwargs: Any + ) -> None: + """ + :keyword all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :paramtype all_of: ~azure.mgmt.automation.models.TrackedResource + :keyword content_link: Gets or sets the package content link. + :paramtype content_link: ~azure.mgmt.automation.models.ContentLink + """ + super().__init__(**kwargs) + self.all_of = all_of + self.content_link = content_link + + class PrivateEndpointConnection(ProxyResource): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar private_endpoint: Private endpoint which the connection belongs to. :vartype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty :ivar group_ids: Gets the groupIds. @@ -5220,12 +5786,14 @@ class PrivateEndpointConnection(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointProperty"}, "group_ids": {"key": "properties.groupIds", "type": "[str]"}, "private_link_service_connection_state": { @@ -5240,8 +5808,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, group_ids: Optional[List[str]] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: Private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty @@ -5269,7 +5837,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection] @@ -5289,7 +5857,7 @@ class PrivateEndpointProperty(_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: Resource id of the private endpoint. :paramtype id: str @@ -5303,12 +5871,17 @@ class PrivateLinkResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. @@ -5319,6 +5892,7 @@ class PrivateLinkResource(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "group_id": {"readonly": True}, "required_members": {"readonly": True}, } @@ -5327,11 +5901,12 @@ class PrivateLinkResource(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "group_id": {"key": "properties.groupId", "type": "str"}, "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None @@ -5349,7 +5924,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.automation.models.PrivateLinkResource] @@ -5382,7 +5957,7 @@ class PrivateLinkServiceConnectionStateProperty(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword status: The private link service connection status. :paramtype status: str @@ -5415,7 +5990,9 @@ class PythonPackageCreateParameters(_serialization.Model): "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, } - def __init__(self, *, content_link: "_models.ContentLink", tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, *, content_link: "_models.ContentLink", tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: """ :keyword tags: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] @@ -5438,7 +6015,7 @@ class PythonPackageUpdateParameters(_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: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] @@ -5471,8 +6048,8 @@ def __init__( schema_version: Optional[str] = None, runbook_definition: Optional[str] = None, runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword schema_version: Schema version of the serializer. :paramtype schema_version: str @@ -5499,7 +6076,7 @@ class RunAsCredentialAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the credential. :paramtype name: str @@ -5513,21 +6090,30 @@ class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar etag: Gets or sets the etag of the resource. :vartype etag: str + :ivar runtime_environment: Runtime Environment of the runbook execution. + :vartype runtime_environment: str :ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2", - and "Python3". + "Python3", and "Python". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar publish_content_link: Gets or sets the published runbook content link. :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink @@ -5565,15 +6151,19 @@ class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "etag": {"key": "etag", "type": "str"}, + "runtime_environment": {"key": "properties.runtimeEnvironment", "type": "str"}, "runbook_type": {"key": "properties.runbookType", "type": "str"}, "publish_content_link": {"key": "properties.publishContentLink", "type": "ContentLink"}, "state": {"key": "properties.state", "type": "str"}, @@ -5594,9 +6184,10 @@ class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes def __init__( self, *, + location: str, tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, etag: Optional[str] = None, + runtime_environment: Optional[str] = None, runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None, publish_content_link: Optional["_models.ContentLink"] = None, state: Optional[Union[str, "_models.RunbookState"]] = None, @@ -5612,18 +6203,20 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str + :keyword runtime_environment: Runtime Environment of the runbook execution. + :paramtype runtime_environment: str :keyword runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "Python". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword publish_content_link: Gets or sets the published runbook content link. :paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink @@ -5658,6 +6251,7 @@ def __init__( """ super().__init__(tags=tags, location=location, **kwargs) self.etag = etag + self.runtime_environment = runtime_environment self.runbook_type = runbook_type self.publish_content_link = publish_content_link self.state = state @@ -5686,7 +6280,7 @@ class RunbookAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the runbook. :paramtype name: str @@ -5712,7 +6306,7 @@ class RunbookCreateOrUpdateDraftParameters(_serialization.Model): "runbook_content": {"key": "runbookContent", "type": "str"}, } - def __init__(self, *, runbook_content: str, **kwargs): + def __init__(self, *, runbook_content: str, **kwargs: Any) -> None: """ :keyword runbook_content: Content of the Runbook. Required. :paramtype runbook_content: str @@ -5730,9 +6324,11 @@ class RunbookCreateOrUpdateDraftProperties(_serialization.Model): :vartype log_verbose: bool :ivar log_progress: Gets or sets progress log option. :vartype log_progress: bool + :ivar runtime_environment: Environment of the runbook. + :vartype runtime_environment: str :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "Python". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar draft: Gets or sets the draft runbook properties. Required. :vartype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5750,6 +6346,7 @@ class RunbookCreateOrUpdateDraftProperties(_serialization.Model): _attribute_map = { "log_verbose": {"key": "logVerbose", "type": "bool"}, "log_progress": {"key": "logProgress", "type": "bool"}, + "runtime_environment": {"key": "runtimeEnvironment", "type": "str"}, "runbook_type": {"key": "runbookType", "type": "str"}, "draft": {"key": "draft", "type": "RunbookDraft"}, "description": {"key": "description", "type": "str"}, @@ -5763,18 +6360,21 @@ def __init__( draft: "_models.RunbookDraft", log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, + runtime_environment: Optional[str] = None, description: Optional[str] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_verbose: Gets or sets verbose log option. :paramtype log_verbose: bool :keyword log_progress: Gets or sets progress log option. :paramtype log_progress: bool + :keyword runtime_environment: Environment of the runbook. + :paramtype runtime_environment: str :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". + "GraphPowerShell", "Python2", "Python3", and "Python". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword draft: Gets or sets the draft runbook properties. Required. :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5786,13 +6386,14 @@ def __init__( super().__init__(**kwargs) self.log_verbose = log_verbose self.log_progress = log_progress + self.runtime_environment = runtime_environment self.runbook_type = runbook_type self.draft = draft self.description = description self.log_activity_trace = log_activity_trace -class RunbookCreateOrUpdateParameters(_serialization.Model): +class RunbookCreateOrUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """The parameters supplied to the create or update runbook operation. All required parameters must be populated in order to send to Azure. @@ -5807,9 +6408,11 @@ class RunbookCreateOrUpdateParameters(_serialization.Model): :vartype log_verbose: bool :ivar log_progress: Gets or sets progress log option. :vartype log_progress: bool + :ivar runtime_environment: Environment of the runbook. + :vartype runtime_environment: str :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "Python". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar draft: Gets or sets the draft runbook properties. :vartype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5831,6 +6434,7 @@ class RunbookCreateOrUpdateParameters(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, "log_progress": {"key": "properties.logProgress", "type": "bool"}, + "runtime_environment": {"key": "properties.runtimeEnvironment", "type": "str"}, "runbook_type": {"key": "properties.runbookType", "type": "str"}, "draft": {"key": "properties.draft", "type": "RunbookDraft"}, "publish_content_link": {"key": "properties.publishContentLink", "type": "ContentLink"}, @@ -5847,12 +6451,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, + runtime_environment: Optional[str] = None, draft: Optional["_models.RunbookDraft"] = None, publish_content_link: Optional["_models.ContentLink"] = None, description: Optional[str] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -5864,9 +6469,11 @@ def __init__( :paramtype log_verbose: bool :keyword log_progress: Gets or sets progress log option. :paramtype log_progress: bool + :keyword runtime_environment: Environment of the runbook. + :paramtype runtime_environment: str :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". + "GraphPowerShell", "Python2", "Python3", and "Python". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword draft: Gets or sets the draft runbook properties. :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5883,6 +6490,7 @@ def __init__( self.tags = tags self.log_verbose = log_verbose self.log_progress = log_progress + self.runtime_environment = runtime_environment self.runbook_type = runbook_type self.draft = draft self.publish_content_link = publish_content_link @@ -5925,8 +6533,8 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None, output_types: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword in_edit: Gets or sets whether runbook is in edit mode. :paramtype in_edit: bool @@ -5962,7 +6570,7 @@ class RunbookDraftUndoEditResult(_serialization.Model): "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". + "HttpVersionNotSupported", and "Continue". :vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :ivar request_id: :vartype request_id: str @@ -5978,8 +6586,8 @@ def __init__( *, status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, request_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", @@ -5990,7 +6598,7 @@ def __init__( "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". + "HttpVersionNotSupported", and "Continue". :paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :keyword request_id: :paramtype request_id: str @@ -6014,7 +6622,9 @@ class RunbookListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of runbooks. :paramtype value: list[~azure.mgmt.automation.models.Runbook] @@ -6054,8 +6664,8 @@ def __init__( is_mandatory: Optional[bool] = None, position: Optional[int] = None, default_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the type of the parameter. :paramtype type: str @@ -6113,8 +6723,8 @@ def __init__( log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -6141,17 +6751,169 @@ def __init__( self.log_activity_trace = log_activity_trace +class RuntimeEnvironment(TrackedResource): + """Definition of the Runtime Environment type. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar default_packages: List of Default packages for Environment. + :vartype default_packages: dict[str, str] + :ivar description: Gets or sets the description. + :vartype description: str + :ivar language: Language of Runtime Environment. + :vartype language: str + :ivar version: Version of Language. + :vartype version: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "default_packages": {"key": "properties.defaultPackages", "type": "{str}"}, + "description": {"key": "properties.description", "type": "str"}, + "language": {"key": "properties.runtime.language", "type": "str"}, + "version": {"key": "properties.runtime.version", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + default_packages: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + language: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword default_packages: List of Default packages for Environment. + :paramtype default_packages: dict[str, str] + :keyword description: Gets or sets the description. + :paramtype description: str + :keyword language: Language of Runtime Environment. + :paramtype language: str + :keyword version: Version of Language. + :paramtype version: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.default_packages = default_packages + self.description = description + self.language = language + self.version = version + + +class RuntimeEnvironmentListResult(_serialization.Model): + """List of all the Runtime Environments of automation account. + + :ivar value: list of RuntimeEnvironment. + :vartype value: list[~azure.mgmt.automation.models.RuntimeEnvironment] + :ivar next_link: Gets or sets the next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RuntimeEnvironment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.RuntimeEnvironment"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: list of RuntimeEnvironment. + :paramtype value: list[~azure.mgmt.automation.models.RuntimeEnvironment] + :keyword next_link: Gets or sets the next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RuntimeEnvironmentUpdateParameters(_serialization.Model): + """The parameters supplied to the update automation account operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar default_packages: List of Default packages for Environment. + :vartype default_packages: dict[str, str] + """ + + _validation = { + "system_data": {"readonly": True}, + } + + _attribute_map = { + "system_data": {"key": "systemData", "type": "SystemData"}, + "default_packages": {"key": "properties.defaultPackages", "type": "{str}"}, + } + + def __init__(self, *, default_packages: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword default_packages: List of Default packages for Environment. + :paramtype default_packages: dict[str, str] + """ + super().__init__(**kwargs) + self.system_data = None + self.default_packages = default_packages + + class Schedule(ProxyResource): # pylint: disable=too-many-instance-attributes """Definition of the schedule. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar start_time: Gets or sets the start time of the schedule. :vartype start_time: ~datetime.datetime :ivar start_time_offset_minutes: Gets the start time's offset in minutes. @@ -6187,6 +6949,7 @@ class Schedule(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "start_time_offset_minutes": {"readonly": True}, } @@ -6194,6 +6957,7 @@ class Schedule(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "start_time": {"key": "properties.startTime", "type": "iso-8601"}, "start_time_offset_minutes": {"key": "properties.startTimeOffsetMinutes", "type": "float"}, "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, @@ -6226,8 +6990,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time: Gets or sets the start time of the schedule. :paramtype start_time: ~datetime.datetime @@ -6285,7 +7049,7 @@ class ScheduleAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the Schedule. :paramtype name: str @@ -6346,8 +7110,8 @@ def __init__( interval: Optional[Any] = None, time_zone: Optional[str] = None, advanced_schedule: Optional["_models.AdvancedSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the Schedule. Required. :paramtype name: str @@ -6392,7 +7156,9 @@ class ScheduleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of schedules. :paramtype value: list[~azure.mgmt.automation.models.Schedule] @@ -6427,8 +7193,8 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, is_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the Schedule. :paramtype name: str @@ -6473,8 +7239,8 @@ def __init__( name: Union[str, "_models.SkuNameEnum"], family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and "Basic". @@ -6560,8 +7326,8 @@ def __init__( schedule_info: "_models.SUCScheduleProperties", error: Optional["_models.ErrorResponse"] = None, tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword update_configuration: update specific properties for the Software update configuration. Required. @@ -6648,8 +7414,8 @@ def __init__( frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, start_time: Optional[datetime.datetime] = None, next_run: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword update_configuration: Update specific properties of the software update configuration. :paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration @@ -6687,7 +7453,9 @@ class SoftwareUpdateConfigurationListResult(_serialization.Model): "value": {"key": "value", "type": "[SoftwareUpdateConfigurationCollectionItem]"}, } - def __init__(self, *, value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configurations. :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem] @@ -6788,8 +7556,8 @@ def __init__( software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, job: Optional["_models.JobNavigation"] = None, error: Optional["_models.ErrorResponse"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword software_update_configuration: software update configuration triggered this run. :paramtype software_update_configuration: @@ -6839,8 +7607,8 @@ def __init__( *, value: Optional[List["_models.SoftwareUpdateConfigurationMachineRun"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configuration machine runs. @@ -6933,8 +7701,8 @@ def __init__( *, software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword software_update_configuration: software update configuration triggered this run. :paramtype software_update_configuration: @@ -6979,8 +7747,8 @@ def __init__( *, value: Optional[List["_models.SoftwareUpdateConfigurationRun"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configuration runs. :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun] @@ -7010,8 +7778,8 @@ class SoftwareUpdateConfigurationRunTaskProperties(_serialization.Model): } def __init__( - self, *, status: Optional[str] = None, source: Optional[str] = None, job_id: Optional[str] = None, **kwargs - ): + self, *, status: Optional[str] = None, source: Optional[str] = None, job_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword status: The status of the task. :paramtype status: str @@ -7045,8 +7813,8 @@ def __init__( *, pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pre_task: Pre task properties. :paramtype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties @@ -7078,8 +7846,8 @@ def __init__( *, pre_task: Optional["_models.TaskProperties"] = None, post_task: Optional["_models.TaskProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pre_task: Pre task properties. :paramtype pre_task: ~azure.mgmt.automation.models.TaskProperties @@ -7096,12 +7864,17 @@ class SourceControl(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar repo_url: The repo url of the source control. :vartype repo_url: str :ivar branch: The repo branch of the source control. Include branch as empty string for @@ -7128,12 +7901,14 @@ class SourceControl(ProxyResource): # pylint: disable=too-many-instance-attribu "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "repo_url": {"key": "properties.repoUrl", "type": "str"}, "branch": {"key": "properties.branch", "type": "str"}, "folder_path": {"key": "properties.folderPath", "type": "str"}, @@ -7157,8 +7932,8 @@ def __init__( description: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword repo_url: The repo url of the source control. :paramtype repo_url: str @@ -7245,8 +8020,8 @@ def __init__( source_type: Optional[Union[str, "_models.SourceType"]] = None, security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword repo_url: The repo url of the source control. :paramtype repo_url: str @@ -7293,8 +8068,8 @@ class SourceControlListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of source controls. :paramtype value: list[~azure.mgmt.automation.models.SourceControl] @@ -7335,8 +8110,8 @@ def __init__( access_token: Optional[str] = None, refresh_token: Optional[str] = None, token_type: Optional[Union[str, "_models.TokenType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword access_token: The access token. :paramtype access_token: str @@ -7405,8 +8180,8 @@ def __init__( source_control_sync_job_id: Optional[str] = None, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, sync_type: Optional[Union[str, "_models.SyncType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_id: The source control sync job id. :paramtype source_control_sync_job_id: str @@ -7477,8 +8252,8 @@ def __init__( provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, sync_type: Optional[Union[str, "_models.SyncType"]] = None, exception: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the job. :paramtype id: str @@ -7521,7 +8296,7 @@ class SourceControlSyncJobCreateParameters(_serialization.Model): "commit_id": {"key": "properties.commitId", "type": "str"}, } - def __init__(self, *, commit_id: str, **kwargs): + def __init__(self, *, commit_id: str, **kwargs: Any) -> None: """ :keyword commit_id: The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. Required. @@ -7546,8 +8321,12 @@ class SourceControlSyncJobListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SourceControlSyncJob"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SourceControlSyncJob"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of source control sync jobs. :paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJob] @@ -7595,8 +8374,8 @@ def __init__( source_control_sync_job_stream_id: Optional[str] = None, summary: Optional[str] = None, stream_type: Optional[Union[str, "_models.StreamType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_stream_id: The sync job stream id. :paramtype source_control_sync_job_stream_id: str @@ -7657,8 +8436,8 @@ def __init__( stream_type: Optional[Union[str, "_models.StreamType"]] = None, stream_text: Optional[str] = None, value: Optional[Dict[str, JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_stream_id: The sync job stream id. :paramtype source_control_sync_job_stream_id: str @@ -7701,7 +8480,7 @@ class SourceControlSyncJobStreamsListBySyncJob(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SourceControlSyncJobStream"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SourceControlSyncJobStream"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of source control sync job streams. :paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream] @@ -7746,8 +8525,8 @@ def __init__( publish_runbook: Optional[bool] = None, security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword branch: The repo branch of the source control. :paramtype branch: str @@ -7804,7 +8583,7 @@ class Statistics(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.counter_property = None @@ -7825,7 +8604,7 @@ class StatisticsListResult(_serialization.Model): "value": {"key": "value", "type": "[Statistics]"}, } - def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets a list of statistics. :paramtype value: list[~azure.mgmt.automation.models.Statistics] @@ -7907,8 +8686,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time: Gets or sets the start time of the schedule. :paramtype start_time: ~datetime.datetime @@ -7992,8 +8771,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 @@ -8039,8 +8818,8 @@ def __init__( *, tags: Optional[Dict[str, List[str]]] = None, filter_operator: Optional[Union[str, "_models.TagOperators"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Dictionary of tags with its list of values. :paramtype tags: dict[str, list[str]] @@ -8072,8 +8851,8 @@ def __init__( *, azure_queries: Optional[List["_models.AzureQueryProperties"]] = None, non_azure_queries: Optional[List["_models.NonAzureQueryProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_queries: List of Azure queries in the software update configuration. :paramtype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties] @@ -8099,7 +8878,9 @@ class TaskProperties(_serialization.Model): "source": {"key": "source", "type": "str"}, } - def __init__(self, *, parameters: Optional[Dict[str, str]] = None, source: Optional[str] = None, **kwargs): + def __init__( + self, *, parameters: Optional[Dict[str, str]] = None, source: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword parameters: Gets or sets the parameters of the task. :paramtype parameters: dict[str, str] @@ -8167,8 +8948,8 @@ def __init__( last_status_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, str]] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword creation_time: Gets or sets the creation time of the test job. :paramtype creation_time: ~datetime.datetime @@ -8216,24 +8997,37 @@ class TestJobCreateParameters(_serialization.Model): :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be executed. :vartype run_on: str + :ivar runtime_environment: The runtime Environment Name on which job needs to be tested. + :vartype runtime_environment: str """ _attribute_map = { "parameters": {"key": "parameters", "type": "{str}"}, "run_on": {"key": "runOn", "type": "str"}, + "runtime_environment": {"key": "runtimeEnvironment", "type": "str"}, } - def __init__(self, *, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, **kwargs): + def __init__( + self, + *, + parameters: Optional[Dict[str, str]] = None, + run_on: Optional[str] = None, + runtime_environment: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword parameters: Gets or sets the parameters of the test job. :paramtype parameters: dict[str, str] :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be executed. :paramtype run_on: str + :keyword runtime_environment: The runtime Environment Name on which job needs to be tested. + :paramtype runtime_environment: str """ super().__init__(**kwargs) self.parameters = parameters self.run_on = run_on + self.runtime_environment = runtime_environment class TypeField(_serialization.Model): @@ -8250,7 +9044,7 @@ class TypeField(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the field. :paramtype name: str @@ -8273,7 +9067,7 @@ class TypeFieldListResult(_serialization.Model): "value": {"key": "value", "type": "[TypeField]"}, } - def __init__(self, *, value: Optional[List["_models.TypeField"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TypeField"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets a list of fields. :paramtype value: list[~azure.mgmt.automation.models.TypeField] @@ -8331,8 +9125,8 @@ def __init__( azure_virtual_machines: Optional[List[str]] = None, non_azure_computer_names: Optional[List[str]] = None, targets: Optional["_models.TargetProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operating_system: operating system of target machines. Required. Known values are: "Windows" and "Linux". @@ -8381,7 +9175,7 @@ class UpdateConfigurationNavigation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -8422,8 +9216,8 @@ def __init__( current_value: Optional[float] = None, limit: Optional[int] = None, throttle_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -8461,7 +9255,7 @@ class UsageCounterName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets the usage counter name. :paramtype value: str @@ -8484,7 +9278,7 @@ class UsageListResult(_serialization.Model): "value": {"key": "value", "type": "[Usage]"}, } - def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets usage. :paramtype value: list[~azure.mgmt.automation.models.Usage] @@ -8514,7 +9308,7 @@ class UserAssignedIdentitiesProperties(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -8526,12 +9320,17 @@ class Variable(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar value: Gets or sets the value of the variable. :vartype value: str :ivar is_encrypted: Gets or sets the encrypted flag of the variable. @@ -8548,12 +9347,14 @@ class Variable(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "value": {"key": "properties.value", "type": "str"}, "is_encrypted": {"key": "properties.isEncrypted", "type": "bool"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, @@ -8569,8 +9370,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets the value of the variable. :paramtype value: str @@ -8624,8 +9425,8 @@ def __init__( value: Optional[str] = None, description: Optional[str] = None, is_encrypted: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the variable. Required. :paramtype name: str @@ -8657,7 +9458,9 @@ class VariableListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of variables. :paramtype value: list[~azure.mgmt.automation.models.Variable] @@ -8687,8 +9490,13 @@ class VariableUpdateParameters(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, value: Optional[str] = None, description: Optional[str] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the variable. :paramtype name: str @@ -8708,12 +9516,17 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar etag: Gets or sets the etag of the resource. :vartype etag: str :ivar tags: Resource tags. @@ -8746,6 +9559,7 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "status": {"readonly": True}, "creation_time": {"readonly": True}, "last_modified_time": {"readonly": True}, @@ -8756,6 +9570,7 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, @@ -8781,8 +9596,8 @@ def __init__( script_parameters: Optional[Dict[str, str]] = None, script_run_on: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str @@ -8833,7 +9648,9 @@ class WatcherListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of watchers. :paramtype value: list[~azure.mgmt.automation.models.Watcher] @@ -8860,7 +9677,9 @@ class WatcherUpdateParameters(_serialization.Model): "execution_frequency_in_seconds": {"key": "properties.executionFrequencyInSeconds", "type": "int"}, } - def __init__(self, *, name: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -8878,12 +9697,17 @@ class Webhook(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar is_enabled: Gets or sets the value of the enabled flag of the webhook. :vartype is_enabled: bool :ivar uri: Gets or sets the webhook uri. @@ -8913,12 +9737,14 @@ class Webhook(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, "uri": {"key": "properties.uri", "type": "str"}, "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, @@ -8946,8 +9772,8 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Gets or sets the value of the enabled flag of the webhook. :paramtype is_enabled: bool @@ -9032,8 +9858,8 @@ def __init__( parameters: Optional[Dict[str, str]] = None, runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the webhook. Required. :paramtype name: str @@ -9074,7 +9900,9 @@ class WebhookListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of webhooks. :paramtype value: list[~azure.mgmt.automation.models.Webhook] @@ -9117,8 +9945,8 @@ def __init__( run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the webhook. :paramtype name: str @@ -9170,8 +9998,8 @@ def __init__( excluded_kb_numbers: Optional[List[str]] = None, included_kb_numbers: Optional[List[str]] = None, reboot_setting: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword included_update_classifications: Update classification included in the software update configuration. A comma separated string with required values. Known values are: "Unclassified", diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index ceadd5d1de73..0487495d9bdf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -6,18 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._node_count_information_operations import NodeCountInformationOperations +from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations +from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._agent_registration_information_operations import AgentRegistrationInformationOperations from ._dsc_node_operations import DscNodeOperations from ._node_reports_operations import NodeReportsOperations -from ._dsc_compilation_job_operations import DscCompilationJobOperations -from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations -from ._node_count_information_operations import NodeCountInformationOperations -from ._watcher_operations import WatcherOperations -from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations -from ._webhook_operations import WebhookOperations -from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations from ._automation_account_operations import AutomationAccountOperations from ._statistics_operations import StatisticsOperations from ._usages_operations import UsagesOperations @@ -26,6 +21,8 @@ from ._connection_operations import ConnectionOperations from ._connection_type_operations import ConnectionTypeOperations from ._credential_operations import CredentialOperations +from ._dsc_compilation_job_operations import DscCompilationJobOperations +from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from ._dsc_configuration_operations import DscConfigurationOperations from ._dsc_node_configuration_operations import DscNodeConfigurationOperations from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations @@ -40,12 +37,16 @@ from ._fields_operations import FieldsOperations from ._operations import Operations from ._automation_client_operations import AutomationClientOperationsMixin +from ._package_operations import PackageOperations +from ._packages_operations import PackagesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._python2_package_operations import Python2PackageOperations from ._python3_package_operations import Python3PackageOperations from ._runbook_draft_operations import RunbookDraftOperations from ._runbook_operations import RunbookOperations from ._test_job_streams_operations import TestJobStreamsOperations from ._test_job_operations import TestJobOperations +from ._runtime_environments_operations import RuntimeEnvironmentsOperations from ._schedule_operations import ScheduleOperations from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations @@ -53,24 +54,21 @@ from ._source_control_sync_job_operations import SourceControlSyncJobOperations from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations from ._variable_operations import VariableOperations +from ._watcher_operations import WatcherOperations +from ._webhook_operations import WebhookOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PrivateEndpointConnectionsOperations", + "NodeCountInformationOperations", + "SoftwareUpdateConfigurationsOperations", + "DeletedAutomationAccountsOperations", "PrivateLinkResourcesOperations", "AgentRegistrationInformationOperations", "DscNodeOperations", "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "NodeCountInformationOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "WebhookOperations", - "DeletedAutomationAccountsOperations", "AutomationAccountOperations", "StatisticsOperations", "UsagesOperations", @@ -79,6 +77,8 @@ "ConnectionOperations", "ConnectionTypeOperations", "CredentialOperations", + "DscCompilationJobOperations", + "DscCompilationJobStreamOperations", "DscConfigurationOperations", "DscNodeConfigurationOperations", "HybridRunbookWorkersOperations", @@ -93,12 +93,16 @@ "FieldsOperations", "Operations", "AutomationClientOperationsMixin", + "PackageOperations", + "PackagesOperations", + "PrivateEndpointConnectionsOperations", "Python2PackageOperations", "Python3PackageOperations", "RunbookDraftOperations", "RunbookOperations", "TestJobStreamsOperations", "TestJobOperations", + "RuntimeEnvironmentsOperations", "ScheduleOperations", "SoftwareUpdateConfigurationMachineRunsOperations", "SoftwareUpdateConfigurationRunsOperations", @@ -106,6 +110,8 @@ "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", "VariableOperations", + "WatcherOperations", + "WebhookOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py index 7838406aef1b..124058a55110 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +65,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +82,7 @@ def build_list_by_module_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +99,7 @@ def build_list_by_module_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,6 +140,9 @@ def get( ) -> _models.Activity: """Retrieve the activity in the module identified by module name and activity name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -168,7 +167,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) request = build_get_request( @@ -185,8 +184,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,6 +213,9 @@ def list_by_module( ) -> Iterable["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -227,7 +230,7 @@ def list_by_module( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) error_map = { @@ -255,7 +258,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -271,8 +285,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py index d87013f69d5a..9aa89fb360a8 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +57,7 @@ def build_get_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,9 +74,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +91,7 @@ def build_regenerate_key_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,6 +127,9 @@ def __init__(self, *args, **kwargs): def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.AgentRegistration: """Retrieve the automation agent registration information. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,9 +150,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) request = build_get_request( @@ -172,8 +165,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,6 +200,9 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -233,6 +230,9 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -258,12 +258,15 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a model - type or a IO type. Required. + :param parameters: The name of the agent registration key to be regenerated. Is either a + AgentRegistrationRegenerateKeyParameter type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -284,16 +287,14 @@ def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") @@ -313,8 +314,9 @@ def regenerate_key( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py index 3820d0877719..db69431f7cf5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -63,7 +60,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +79,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +96,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +115,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +131,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +164,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,7 +179,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +194,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,7 +209,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +220,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -234,6 +231,41 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_deleted_runbooks_request( + resource_group_name: str, automation_account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listDeletedRunbooks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class AutomationAccountOperations: """ .. warning:: @@ -265,6 +297,9 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -292,6 +327,9 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -317,12 +355,15 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the update automation account. Is either a + AutomationAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -343,14 +384,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") @@ -370,8 +411,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -404,6 +446,9 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -431,6 +476,9 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -456,12 +504,15 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param parameters: Parameters supplied to the create or update automation account. Is either a - model type or a IO type. Required. + AutomationAccountCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -482,14 +533,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") @@ -509,8 +560,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,6 +593,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -561,7 +616,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -576,8 +631,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -598,6 +654,9 @@ def delete( # pylint: disable=inconsistent-return-statements def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.AutomationAccount: """Get information about an Automation Account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -618,7 +677,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -633,8 +692,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -659,6 +719,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -669,7 +732,7 @@ 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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -695,7 +758,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -711,8 +785,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -743,7 +818,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -768,7 +843,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -784,8 +870,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -799,3 +886,94 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts"} + + @distributed_trace + def list_deleted_runbooks( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> Iterable["_models.DeletedRunbook"]: + """Retrieve the deleted runbooks for an automation account. + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedRunbook or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DeletedRunbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeletedRunbookListResult] = 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_deleted_runbooks_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted_runbooks.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("DeletedRunbookListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_deleted_runbooks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listDeletedRunbooks" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py index cdfd540f5d97..274b976439b9 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_convert_graph_runbook_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62,7 +58,7 @@ def build_convert_graph_runbook_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,8 +140,8 @@ def convert_graph_runbook_content( :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Input data describing the graphical runbook. Is either a model type or a IO - type. Required. + :param parameters: Input data describing the graphical runbook. Is either a + GraphicalRunbookContent type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -166,14 +162,14 @@ def convert_graph_runbook_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GraphicalRunbookContent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GraphicalRunbookContent") @@ -193,8 +189,9 @@ def convert_graph_runbook_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py index 163a32be6348..0905ede01fb3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Certificate: """Retrieve the certificate identified by certificate name. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +415,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +448,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +459,7 @@ def create_or_update( Required. :type certificate_name: str :param parameters: The parameters supplied to the create or update certificate operation. Is - either a model type or a IO type. Required. + either a CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +480,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -494,8 +508,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +548,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +581,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +612,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +622,7 @@ def update( :param certificate_name: The parameters supplied to the update certificate operation. Required. :type certificate_name: str :param parameters: The parameters supplied to the update certificate operation. Is either a - model type or a IO type. Required. + CertificateUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateUpdateParameters") @@ -647,8 +671,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +700,9 @@ def list_by_automation_account( ) -> Iterable["_models.Certificate"]: """Retrieve a list of certificates. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +715,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) error_map = { @@ -714,7 +742,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -730,8 +769,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py index 408ac1066f5d..4b5330f2175f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Connection: """Retrieve the connection identified by connection name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +415,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +448,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +459,7 @@ def create_or_update( Required. :type connection_name: str :param parameters: The parameters supplied to the create or update connection operation. Is - either a model type or a IO type. Required. + either a ConnectionCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +480,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") @@ -494,8 +508,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +548,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +581,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +612,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +622,7 @@ def update( :param connection_name: The parameters supplied to the update a connection operation. Required. :type connection_name: str :param parameters: The parameters supplied to the update a connection operation. Is either a - model type or a IO type. Required. + ConnectionUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionUpdateParameters") @@ -647,8 +671,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +700,9 @@ def list_by_automation_account( ) -> Iterable["_models.Connection"]: """Retrieve a list of connections. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +715,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -714,7 +742,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -730,8 +769,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py index e0e5c3a1146e..4b129a9c28d4 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +47,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +64,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +123,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +141,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +160,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +176,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -215,6 +212,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,7 +237,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -253,8 +253,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,6 +278,9 @@ def get( ) -> _models.ConnectionType: """Retrieve the connection type identified by connection type name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -299,7 +303,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) request = build_get_request( @@ -315,8 +319,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,6 +355,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,6 +390,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -412,6 +423,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -420,7 +434,7 @@ def create_or_update( operation. Required. :type connection_type_name: str :param parameters: The parameters supplied to the create or update connection type operation. - Is either a model type or a IO type. Required. + Is either a ConnectionTypeCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -441,14 +455,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") @@ -469,8 +483,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,6 +512,9 @@ def list_by_automation_account( ) -> Iterable["_models.ConnectionType"]: """Retrieve a list of connection types. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -509,7 +527,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -536,7 +554,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -552,8 +581,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py index 375027ade7c8..97c8431c44a6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Credential: """Retrieve the credential identified by credential name. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +415,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +448,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +459,7 @@ def create_or_update( Required. :type credential_name: str :param parameters: The parameters supplied to the create or update credential operation. Is - either a model type or a IO type. Required. + either a CredentialCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +480,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") @@ -494,8 +508,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +548,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +581,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +612,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +622,7 @@ def update( :param credential_name: The parameters supplied to the Update credential operation. Required. :type credential_name: str :param parameters: The parameters supplied to the Update credential operation. Is either a - model type or a IO type. Required. + CredentialUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialUpdateParameters") @@ -647,8 +671,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +700,9 @@ def list_by_automation_account( ) -> Iterable["_models.Credential"]: """Retrieve a list of credentials. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +715,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) error_map = { @@ -714,7 +742,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -730,8 +769,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py index d6ac5231db4d..f75a55ba137d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +99,7 @@ def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccoun _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) request = build_list_by_subscription_request( @@ -117,8 +112,9 @@ def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccoun request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py index b8d498a822ea..1804ff722d06 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +49,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72,7 +67,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,9 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +107,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,9 +129,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +145,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -178,9 +169,7 @@ def build_get_stream_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +187,7 @@ def build_get_stream_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,16 +236,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscCompilationJobCreateParameters") @@ -277,8 +264,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,6 +300,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -350,6 +341,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -386,6 +380,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,7 +390,7 @@ def begin_create( :param compilation_job_name: The DSC configuration Id. Required. :type compilation_job_name: str :param parameters: The parameters supplied to the create compilation job operation. Is either a - model type or a IO type. Required. + DscCompilationJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -414,9 +411,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -468,6 +463,9 @@ def get( ) -> _models.DscCompilationJob: """Retrieve the Dsc configuration compilation job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dsccompilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -490,9 +488,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) request = build_get_request( @@ -508,8 +504,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -536,6 +533,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/compilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -550,9 +550,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) error_map = { @@ -580,7 +578,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -596,8 +605,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,6 +630,9 @@ def get_stream( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -644,9 +657,7 @@ def get_stream( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_stream_request( @@ -663,8 +674,9 @@ def get_stream( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py index 7e4fd8be18a1..35ac1ae94368 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_by_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +57,7 @@ def build_list_by_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,6 +93,9 @@ def list_by_job( ) -> _models.JobStreamListResult: """Retrieve all the job streams for the compilation Job. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -122,9 +118,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) request = build_list_by_job_request( @@ -140,8 +134,9 @@ def list_by_job( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py index c32539930fd6..c56f90b5bbc3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py @@ -6,8 +6,8 @@ # 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, Iterator, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +184,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -205,7 +201,7 @@ def build_get_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,7 +226,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +242,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,6 +286,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,7 +311,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -328,8 +327,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,6 +352,9 @@ def get( ) -> _models.DscConfiguration: """Retrieve the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -374,7 +377,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -390,8 +393,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,6 +429,9 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -455,6 +462,9 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -483,14 +493,17 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationCreateOrUpdateParameters type or a str type. Required. :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -511,7 +524,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -539,8 +552,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,6 +592,9 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -608,6 +625,9 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -636,14 +656,17 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Default value is None. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationUpdateParameters type or a str type. Default value is None. :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -664,7 +687,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -698,8 +721,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,6 +750,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the configuration script identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -748,7 +775,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -764,8 +791,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,6 +826,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscConfiguration"]: """Retrieve a list of configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -818,7 +849,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -849,7 +880,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -865,8 +907,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py index 9d05b99c479b..b60eb80d9751 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +49,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +66,7 @@ def build_delete_request( "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +104,7 @@ def build_get_request( "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +125,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +143,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +170,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +186,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,6 +230,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -255,7 +255,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -271,8 +271,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,6 +296,9 @@ def get( ) -> _models.DscNodeConfiguration: """Retrieve the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -317,7 +321,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -333,8 +337,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,14 +379,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscNodeConfigurationCreateOrUpdateParameters") @@ -402,8 +407,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,9 +442,12 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,9 +483,12 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -510,17 +522,20 @@ def begin_create_or_update( node_configuration_name: str, parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param node_configuration_name: The Dsc node configuration name. Required. :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a IO type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscNodeConfigurationCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -542,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -601,6 +616,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -622,7 +640,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -653,7 +671,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -669,8 +698,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py index b3a9240a65ac..6dc5c9909f63 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,9 +111,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,7 +129,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +156,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +172,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -227,6 +216,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -249,9 +241,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -267,8 +257,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,6 +282,9 @@ def get( ) -> _models.DscNode: """Retrieve the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -313,9 +307,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) request = build_get_request( @@ -331,8 +323,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,6 +359,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,6 +392,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -424,6 +423,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -431,7 +433,7 @@ def update( :param node_id: Parameters supplied to the update dsc node. Required. :type node_id: str :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - model type or a IO type. Required. + DscNodeUpdateParameters type or a IO type. Required. :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,16 +454,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dsc_node_update_parameters, (IO, bytes)): + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): _content = dsc_node_update_parameters else: _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") @@ -482,8 +482,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,6 +518,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscNode"]: """Retrieve a list of dsc nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -537,9 +541,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) error_map = { @@ -570,7 +572,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -586,8 +599,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py index 97511e77ab4f..6a0dede79947 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_list_by_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +65,7 @@ def build_list_by_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,6 +101,9 @@ def list_by_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/typefieldoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -121,7 +120,7 @@ def list_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -150,7 +149,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -166,8 +176,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py index 50ecad63e97e..27f4af305cc0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +47,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +66,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +106,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,7 +127,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +147,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +170,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -193,7 +190,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,7 +214,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +230,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -275,6 +272,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,7 +297,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -313,8 +313,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,6 +342,9 @@ def get( ) -> _models.HybridRunbookWorkerGroup: """Retrieve a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +367,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -379,8 +383,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,6 +419,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -446,6 +454,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -477,6 +488,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -484,7 +498,8 @@ def create( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for - hybrid runbook worker group. Is either a model type or a IO type. Required. + hybrid runbook worker group. Is either a HybridRunbookWorkerGroupCreateOrUpdateParameters type + or a IO type. Required. :type hybrid_runbook_worker_group_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -506,14 +521,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_creation_parameters else: _json = self._serialize.body( @@ -536,8 +551,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,6 +591,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -607,6 +626,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -638,6 +660,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -645,7 +670,7 @@ def update( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_updation_parameters: The hybrid runbook worker group. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO type. Required. :type hybrid_runbook_worker_group_updation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -667,14 +692,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_updation_parameters else: _json = self._serialize.body( @@ -697,8 +722,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,6 +751,9 @@ def list_by_automation_account( ) -> Iterable["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -740,7 +769,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) error_map = { @@ -768,7 +797,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -784,8 +824,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py index a5f04677e394..212ec278e38c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +48,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +68,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +110,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,7 +132,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +153,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,6 +166,51 @@ def build_create_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_patch_request( + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + "hybridRunbookWorkerId": _SERIALIZER.url("hybrid_runbook_worker_id", hybrid_runbook_worker_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + def build_move_request( resource_group_name: str, automation_account_name: str, @@ -180,7 +222,7 @@ def build_move_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +243,7 @@ def build_move_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,7 +268,7 @@ def build_list_by_hybrid_runbook_worker_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,7 +287,7 @@ def build_list_by_hybrid_runbook_worker_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -288,6 +330,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,7 +357,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -329,8 +374,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +404,9 @@ def get( ) -> _models.HybridRunbookWorker: """Retrieve a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,7 +431,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) request = build_get_request( @@ -399,8 +448,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,6 +485,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -470,6 +523,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -502,6 +558,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -511,7 +570,7 @@ def create( :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid - runbook worker. Is either a model type or a IO type. Required. + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Required. :type hybrid_runbook_worker_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -533,14 +592,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_creation_parameters else: _json = self._serialize.body( @@ -564,8 +623,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -590,6 +650,187 @@ def create( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" } + @overload + def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[_models.HybridRunbookWorkerCreateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Default value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters + :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: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Default value is None. + :type hybrid_runbook_worker_creation_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + hybrid_runbook_worker_creation_parameters: Optional[ + Union[_models.HybridRunbookWorkerCreateParameters, IO] + ] = None, + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. + :type hybrid_runbook_worker_id: str + :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Default + value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters 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: HybridRunbookWorker or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + if hybrid_runbook_worker_creation_parameters is not None: + _json = self._serialize.body( + hybrid_runbook_worker_creation_parameters, "HybridRunbookWorkerCreateParameters" + ) + else: + _json = None + + request = build_patch_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, + hybrid_runbook_worker_id=hybrid_runbook_worker_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HybridRunbookWorker", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + } + @overload def move( # pylint: disable=inconsistent-return-statements self, @@ -604,6 +845,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -639,6 +883,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -671,6 +918,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -680,7 +930,7 @@ def move( # pylint: disable=inconsistent-return-statements :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerMoveParameters type or a IO type. Required. :type hybrid_runbook_worker_move_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -702,14 +952,14 @@ def move( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_move_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_move_parameters else: _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") @@ -731,8 +981,9 @@ def move( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -760,6 +1011,9 @@ def list_by_hybrid_runbook_worker_group( ) -> Iterable["_models.HybridRunbookWorker"]: """Retrieve a list of hybrid runbook workers. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -776,7 +1030,7 @@ def list_by_hybrid_runbook_worker_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) error_map = { @@ -805,7 +1059,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -821,8 +1086,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py index 1f32175053c2..a3f75b21f5c0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +49,7 @@ def build_get_output_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "text/plain") # Construct URL @@ -69,7 +66,7 @@ def build_get_output_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +91,7 @@ def build_get_runbook_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -111,7 +108,7 @@ def build_get_runbook_content_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +133,7 @@ def build_suspend_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +150,7 @@ def build_suspend_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,7 +175,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +192,7 @@ def build_stop_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +217,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +234,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,7 +259,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -280,7 +277,7 @@ def build_create_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -307,7 +304,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +320,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -350,7 +347,7 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -367,7 +364,7 @@ def build_resume_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -410,6 +407,9 @@ def get_output( ) -> str: """Retrieve the job output identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -434,7 +434,7 @@ def get_output( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_output_request( @@ -451,8 +451,9 @@ def get_output( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,6 +484,9 @@ def get_runbook_content( ) -> str: """Retrieve the runbook content of the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -507,7 +511,7 @@ def get_runbook_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_runbook_content_request( @@ -524,8 +528,9 @@ def get_runbook_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,6 +561,9 @@ def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -580,7 +588,7 @@ def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -597,8 +605,9 @@ def suspend( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -626,6 +635,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -650,7 +662,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -667,8 +679,9 @@ def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,6 +709,9 @@ def get( ) -> _models.Job: """Retrieve the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -720,7 +736,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -737,8 +753,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,6 +790,9 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -806,6 +826,9 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -837,14 +860,17 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param job_name: The job name. Required. :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a model type - or a IO type. Required. + :param parameters: The parameters supplied to the create job operation. Is either a + JobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -867,14 +893,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobCreateParameters") @@ -896,8 +922,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,6 +956,9 @@ def list_by_automation_account( ) -> Iterable["_models.JobCollectionItem"]: """Retrieve a list of jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -945,7 +975,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) error_map = { @@ -974,7 +1004,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -990,8 +1031,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,6 +1061,9 @@ def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -1043,7 +1088,7 @@ def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -1060,8 +1105,9 @@ def resume( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py index b5dce81f200f..0d87a92af843 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,7 +153,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +169,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -210,6 +207,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -232,7 +232,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -248,8 +248,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,6 +273,9 @@ def get( ) -> _models.JobSchedule: """Retrieve the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -294,7 +298,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -310,8 +314,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,6 +350,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -375,6 +383,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -403,6 +414,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -410,7 +424,7 @@ def create( :param job_schedule_id: The job schedule name. Required. :type job_schedule_id: str :param parameters: The parameters supplied to the create job schedule operation. Is either a - model type or a IO type. Required. + JobScheduleCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -431,14 +445,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobScheduleCreateParameters") @@ -459,8 +473,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,6 +502,9 @@ def list_by_automation_account( ) -> Iterable["_models.JobSchedule"]: """Retrieve a list of job schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -501,7 +519,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -529,7 +547,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -545,8 +574,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py index 0052d87dde4d..58b5d283f013 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +67,7 @@ def build_get_request( "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +93,7 @@ def build_list_by_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +110,7 @@ def build_list_by_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -160,6 +156,9 @@ def get( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -186,7 +185,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -204,8 +203,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,6 +238,9 @@ def list_by_job( ) -> Iterable["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -256,7 +259,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -286,7 +289,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -302,8 +316,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py index 65d3c2d4f59d..de6fa965d8de 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +112,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) request = build_list_by_automation_account_request( @@ -132,8 +127,9 @@ def list_by_automation_account( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py index 3e65082d6b94..cddd9eaaadea 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,6 +90,9 @@ def __init__(self, *args, **kwargs): def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.LinkedWorkspace: """Retrieve the linked workspace for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/linkedworkspaceoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -115,7 +113,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +128,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py index 2631b4144265..a01bad608c64 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the module by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Module: """Retrieve the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +413,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +444,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The create or update parameters for module. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +475,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") @@ -489,8 +503,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +543,9 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +576,9 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +607,17 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The update parameters for module. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +638,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleUpdateParameters") @@ -642,8 +666,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +695,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +710,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -709,7 +737,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -725,8 +764,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py index efe79673ab61..ed5fa31e92fe 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +61,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,6 +101,9 @@ def get( ) -> _models.NodeCounts: """Retrieve counts for Dsc Nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/nodecounts + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -131,9 +127,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) request = build_get_request( @@ -149,8 +143,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py index fa13f6eca28c..4407787b668a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py @@ -8,6 +8,7 @@ # -------------------------------------------------------------------------- import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,16 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,9 +54,7 @@ def build_list_by_node_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +71,7 @@ def build_list_by_node_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,9 +95,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +113,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +135,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +153,7 @@ def build_get_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,6 +194,9 @@ def list_by_node( ) -> Iterable["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -219,9 +213,7 @@ def list_by_node( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) error_map = { @@ -250,7 +242,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -266,8 +269,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,6 +294,9 @@ def get( ) -> _models.DscNodeReport: """Retrieve the Dsc node report data by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,9 +321,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) request = build_get_request( @@ -333,8 +338,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,6 +367,9 @@ def get_content( ) -> JSON: """Retrieve the Dsc node reports by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -385,9 +394,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_get_content_request( @@ -404,8 +411,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py index a0bd570f9776..3b3ea90485b7 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_list_fields_by_module_and_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +65,7 @@ def build_list_fields_by_module_and_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +82,7 @@ def build_list_fields_by_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +99,7 @@ def build_list_fields_by_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,6 +135,9 @@ def list_fields_by_module_and_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +154,7 @@ def list_fields_by_module_and_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -184,7 +183,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -200,8 +210,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,6 +235,9 @@ def list_fields_by_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -238,7 +252,7 @@ def list_fields_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -266,7 +280,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -282,8 +307,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py index 840ce5a7ac2d..80a9509d9148 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py @@ -6,8 +6,8 @@ # 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, @@ -29,10 +29,6 @@ from .._serialization import Serializer from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -114,7 +110,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -130,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_package_operations.py new file mode 100644 index 000000000000..9fb96fd890f3 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_package_operations.py @@ -0,0 +1,724 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, 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 AutomationClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`package` 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 delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> None: + """Delete the package by name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> _models.Package: + """Retrieve the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters + :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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Is either a + PackageCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters 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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PackageCreateOrUpdateParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Package", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters + :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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageUpdateParameters, IO], + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The name of Package. Required. + :type package_name: str + :param parameters: The update parameters for Package. Is either a PackageUpdateParameters type + or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters 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: Package or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PackageUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Package", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_packages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_packages_operations.py new file mode 100644 index 000000000000..a202291b4cc9 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_packages_operations.py @@ -0,0 +1,193 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import AutomationClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_runtime_environment_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`packages` 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_by_runtime_environment( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> Iterable["_models.Package"]: + """Retrieve the a list of Packages. + + .. seealso:: + - http://aka.ms/azureautomationsdk/packageoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Package or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Package] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageListResult] = 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_by_runtime_environment_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_runtime_environment.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("PackageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_runtime_environment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py index a74811f185c9..b9832c9aa162 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,9 +45,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +61,7 @@ def build_list_by_automation_account_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +101,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,9 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -151,7 +142,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,9 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +184,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,9 +233,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -273,7 +260,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -289,8 +287,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,9 +337,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -356,8 +353,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,16 +394,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -426,8 +422,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,7 +540,7 @@ def begin_create_or_update( :type automation_account_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -564,9 +561,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -630,9 +625,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -648,8 +641,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -659,8 +653,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}" @@ -697,9 +695,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py index 3c4845e592ff..8ae922f6febf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +42,7 @@ def build_automation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +58,7 @@ def build_automation_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,9 +106,7 @@ def automation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -141,7 +133,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -157,8 +160,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py index 9637fdcdee3b..1d5ce6850095 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 2 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Module: """Retrieve the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +413,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +444,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +475,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -489,8 +503,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +543,9 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +576,9 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +607,17 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +638,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -642,8 +666,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +695,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of python 2 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +710,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -709,7 +737,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -725,8 +764,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py index 8a972064ff1b..be2d37e6ca21 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +60,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +129,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +148,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +166,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,6 +237,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 3 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +262,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +278,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +303,9 @@ def get( ) -> _models.Module: """Retrieve the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +344,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +380,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +413,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +444,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +475,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -489,8 +503,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +543,9 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +576,9 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +607,17 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +638,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -642,8 +666,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +695,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of python 3 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +710,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -709,7 +737,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -725,8 +764,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py index 0168fc1dfd72..6e86e9f364a2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -61,10 +56,10 @@ def build_get_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +82,7 @@ def build_replace_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -102,10 +97,10 @@ def build_replace_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +119,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,10 +133,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +153,7 @@ def build_undo_edit_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,10 +167,10 @@ def build_undo_edit_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,6 +206,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the content of runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -233,7 +231,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -249,8 +247,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,7 +288,7 @@ def _replace_content_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[Iterator[bytes]]] = kwargs.pop("cls", None) @@ -310,8 +309,9 @@ def _replace_content_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,6 +349,9 @@ def begin_replace_content( ) -> LROPoller[Iterator[bytes]]: """Replaces the runbook draft content. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -373,7 +376,7 @@ def begin_replace_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -427,6 +430,9 @@ def get( ) -> _models.RunbookDraft: """Retrieve the runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -449,7 +455,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) request = build_get_request( @@ -465,8 +471,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,6 +500,9 @@ def undo_edit( ) -> _models.RunbookDraftUndoEditResult: """Undo draft edit to last known published state identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -515,7 +525,7 @@ def undo_edit( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) request = build_undo_edit_request( @@ -531,8 +541,9 @@ def undo_edit( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py index 3b9098bee619..49778554a734 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +45,7 @@ def build_publish_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,10 +59,10 @@ def build_publish_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +79,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -96,10 +93,10 @@ def build_get_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +113,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,10 +127,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +147,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,10 +162,10 @@ def build_create_or_update_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,7 +184,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,10 +199,10 @@ def build_update_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,7 +221,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,10 +235,10 @@ def build_delete_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,7 +255,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +271,7 @@ def build_list_by_automation_account_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -318,7 +315,7 @@ def _publish_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_publish_request( @@ -334,8 +331,9 @@ def _publish_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,6 +359,9 @@ def begin_publish( ) -> LROPoller[None]: """Publish runbook draft. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,7 +383,7 @@ def begin_publish( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -429,6 +430,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the content of runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -451,7 +455,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -467,8 +471,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,6 +499,9 @@ def get( ) -> _models.Runbook: """Retrieve the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,7 +524,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) request = build_get_request( @@ -532,8 +540,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,6 +576,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,6 +610,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -627,6 +642,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -634,7 +652,8 @@ def create_or_update( :param runbook_name: The runbook name. Required. :type runbook_name: str :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a model type or a IO type. Required. + a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -655,14 +674,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") @@ -683,8 +702,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -722,6 +742,9 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -752,6 +775,9 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -780,14 +806,17 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -808,14 +837,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookUpdateParameters") @@ -836,8 +865,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,6 +894,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the runbook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -886,7 +919,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -902,8 +935,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,6 +960,9 @@ def list_by_automation_account( ) -> Iterable["_models.Runbook"]: """Retrieve a list of runbooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -938,7 +975,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) error_map = { @@ -965,7 +1002,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -981,8 +1029,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runtime_environments_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runtime_environments_operations.py new file mode 100644 index 000000000000..65e262a66c29 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runtime_environments_operations.py @@ -0,0 +1,808 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.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 AutomationClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_update_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url( + "runtime_environment_name", runtime_environment_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_automation_account_request( + resource_group_name: str, automation_account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" + ), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RuntimeEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`runtime_environments` 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") + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironmentUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters + :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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironmentUpdateParameters, IO], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Is either a + RuntimeEnvironmentUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters 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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeEnvironmentUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment + :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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironment, IO], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Is either a + RuntimeEnvironment type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment 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: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeEnvironment") + + request = build_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> None: + """Delete the Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Get information about the Runtime Environment. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runtimeEnvironmentOperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RuntimeEnvironment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + } + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> Iterable["_models.RuntimeEnvironment"]: + """Retrieve a list of RuntimeEnvironments. + + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + + :param resource_group_name: Name of an Azure Resource group. Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuntimeEnvironment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.RuntimeEnvironment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuntimeEnvironmentListResult] = 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_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_automation_account.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("RuntimeEnvironmentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_automation_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py index 7788fca6ce08..fcc6c7e3c23c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +61,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +80,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -101,7 +98,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +117,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +134,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +168,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,6 +244,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,6 +278,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -307,6 +310,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,7 +320,7 @@ def create_or_update( :param schedule_name: The schedule name. Required. :type schedule_name: str :param parameters: The parameters supplied to the create or update schedule operation. Is - either a model type or a IO type. Required. + either a ScheduleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -335,14 +341,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") @@ -363,8 +369,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,6 +410,9 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,6 +443,9 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -461,14 +474,17 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param schedule_name: The schedule name. Required. :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update schedule operation. Is either a + ScheduleUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -489,14 +505,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleUpdateParameters") @@ -517,8 +533,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,6 +562,9 @@ def get( ) -> _models.Schedule: """Retrieve the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -567,7 +587,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( @@ -583,8 +603,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,6 +632,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -633,7 +657,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -649,8 +673,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -673,6 +698,9 @@ def list_by_automation_account( ) -> Iterable["_models.Schedule"]: """Retrieve a list of schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -685,7 +713,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -712,7 +740,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -728,8 +767,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py index 3ad108e767be..e96dd24a5682 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +65,7 @@ def build_get_by_id_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +92,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +108,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,6 +157,9 @@ def get_by_id( ) -> _models.SoftwareUpdateConfigurationMachineRun: """Get a single software update configuration machine run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,7 +185,7 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -204,8 +202,9 @@ def get_by_id( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,6 +238,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: """Return list of software update configuration machine runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -270,7 +272,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -289,8 +291,9 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py index af550b9c2421..dcbc1d3ee384 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +65,7 @@ def build_get_by_id_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +92,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +108,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,6 +157,9 @@ def get_by_id( ) -> _models.SoftwareUpdateConfigurationRun: """Get a single software update configuration Run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,7 +185,7 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -204,8 +202,9 @@ def get_by_id( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,6 +238,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationRunListResult: """Return list of software update configuration runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -270,7 +272,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -289,8 +291,9 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py index 2fc4294217af..798bc2e1d740 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71,7 +67,7 @@ def build_create_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +94,7 @@ def build_get_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +113,7 @@ def build_get_by_name_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +157,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +182,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +198,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -250,6 +246,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -284,6 +283,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -316,6 +318,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -323,7 +328,8 @@ def create( :param software_update_configuration_name: The name of the software update configuration to be created. Required. :type software_update_configuration_name: str - :param parameters: Request body. Is either a model type or a IO type. Required. + :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO type. + Required. :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -346,14 +352,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") @@ -375,8 +381,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,6 +419,9 @@ def get_by_name( ) -> _models.SoftwareUpdateConfiguration: """Get a single software update configuration by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,7 +447,7 @@ def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) request = build_get_by_name_request( @@ -454,8 +464,9 @@ def get_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,6 +498,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """delete a specific software update configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -529,8 +543,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,6 +573,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationListResult: """Get all software update configurations for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -582,7 +600,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -599,8 +617,9 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py index 8c58d2fc5e71..da4f3eed7645 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +47,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +65,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +88,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +106,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +129,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +146,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +167,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +184,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +206,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +222,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -270,6 +267,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -301,6 +301,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -330,6 +333,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -337,7 +343,7 @@ def create_or_update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the create or update source control operation. Is - either a model type or a IO type. Required. + either a SourceControlCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -358,14 +364,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") @@ -386,8 +392,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,6 +432,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -455,6 +465,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -483,6 +496,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -490,7 +506,7 @@ def update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the update source control operation. Is either a - model type or a IO type. Required. + SourceControlUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -511,14 +527,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlUpdateParameters") @@ -539,8 +555,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,6 +584,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -589,7 +609,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -605,8 +625,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,6 +650,9 @@ def get( ) -> _models.SourceControl: """Retrieve the source control identified by source control name. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -651,7 +675,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -667,8 +691,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,6 +720,9 @@ def list_by_automation_account( ) -> Iterable["_models.SourceControl"]: """Retrieve a list of source controls. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -709,7 +737,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) error_map = { @@ -737,7 +765,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -753,8 +792,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py index 0c41e15aa9d1..3096d40c4c5a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -70,7 +67,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +91,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +109,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,7 +132,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +149,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -198,6 +195,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -232,6 +232,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -264,6 +267,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -273,7 +279,7 @@ def create( :param source_control_sync_job_id: The source control sync job id. Required. :type source_control_sync_job_id: str :param parameters: The parameters supplied to the create source control sync job operation. Is - either a model type or a IO type. Required. + either a SourceControlSyncJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,14 +300,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") @@ -323,8 +329,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,6 +363,9 @@ def get( ) -> _models.SourceControlSyncJobById: """Retrieve the source control sync job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -380,7 +390,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) request = build_get_request( @@ -397,8 +407,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,6 +441,9 @@ def list_by_automation_account( ) -> Iterable["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -447,7 +461,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) error_map = { @@ -476,7 +490,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -492,8 +517,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py index 314e759b1941..a55ef0861525 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +49,7 @@ def build_list_by_sync_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +67,7 @@ def build_list_by_sync_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -96,7 +92,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +111,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,6 +153,9 @@ def list_by_sync_job( ) -> Iterable["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -176,7 +175,7 @@ def list_by_sync_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) error_map = { @@ -206,7 +205,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -222,8 +232,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,6 +263,9 @@ def get( ) -> _models.SourceControlSyncJobStreamById: """Retrieve a sync job stream identified by stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,7 +292,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) request = build_get_request( @@ -296,8 +310,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py index c55349c27844..bb0b242ac14e 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +63,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,6 +101,9 @@ def list_by_automation_account( ) -> Iterable["_models.Statistics"]: """Retrieve the statistics for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/statisticsoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -119,7 +118,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) error_map = { @@ -147,7 +146,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -163,8 +173,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py index f9f05316a2c7..15e217d11c64 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -60,10 +56,10 @@ def build_create_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,10 +92,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +112,7 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,10 +126,10 @@ def build_resume_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +146,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,10 +160,10 @@ def build_stop_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +180,7 @@ def build_suspend_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,10 +194,10 @@ def build_suspend_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,6 +240,9 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -274,6 +273,9 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -302,14 +304,17 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The parameters supplied to the create test job operation. Required. :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the create test job operation. Is either a + TestJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -330,14 +335,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestJobCreateParameters") @@ -358,8 +363,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,6 +392,9 @@ def get( ) -> _models.TestJob: """Retrieve the test job for the specified runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -408,7 +417,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) request = build_get_request( @@ -424,8 +433,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,6 +462,9 @@ def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,7 +487,7 @@ def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -490,8 +503,9 @@ def resume( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,6 +528,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -536,7 +553,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -552,8 +569,9 @@ def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -576,6 +594,9 @@ def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +619,7 @@ def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -614,8 +635,9 @@ def suspend( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py index e20b0d12c927..004e20345827 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,11 +61,11 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +88,7 @@ def build_list_by_test_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,10 +102,10 @@ def build_list_by_test_job_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -152,6 +148,9 @@ def get( ) -> _models.JobStream: """Retrieve a test job stream of the test job identified by runbook name and stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -176,7 +175,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -193,8 +192,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,6 +226,9 @@ def list_by_test_job( ) -> Iterable["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -242,7 +245,7 @@ def list_by_test_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -271,7 +274,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -287,8 +301,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py index 46d2b4c00a69..a92475d32e25 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py @@ -6,8 +6,8 @@ # 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, @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +58,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,6 +94,9 @@ def list_by_automation_account( ) -> Iterable["_models.Usage"]: """Retrieve the usage for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/usageoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -110,7 +109,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) error_map = { @@ -137,7 +136,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -153,8 +163,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py index 33b9118074cf..9a789ced8c4a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +61,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +80,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -101,7 +98,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +117,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +134,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +151,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +168,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +185,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +201,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,6 +244,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,6 +278,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -307,6 +310,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,7 +320,7 @@ def create_or_update( :param variable_name: The variable name. Required. :type variable_name: str :param parameters: The parameters supplied to the create or update variable operation. Is - either a model type or a IO type. Required. + either a VariableCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -335,14 +341,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") @@ -363,8 +369,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -402,6 +409,9 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -432,6 +442,9 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -460,14 +473,17 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param variable_name: The variable name. Required. :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update variable operation. Is either a + VariableUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,14 +504,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableUpdateParameters") @@ -516,8 +532,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,6 +561,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -566,7 +586,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -582,8 +602,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,6 +627,9 @@ def get( ) -> _models.Variable: """Retrieve the variable identified by variable name. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -628,7 +652,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) request = build_get_request( @@ -644,8 +668,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,6 +697,9 @@ def list_by_automation_account( ) -> Iterable["_models.Variable"]: """Retrieve a list of variables. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -684,7 +712,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) error_map = { @@ -711,7 +739,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -727,8 +766,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py index 66097fe791af..1b8dff0149bf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +43,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +61,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,9 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +97,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,9 +114,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +132,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,9 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +168,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,9 +185,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +202,7 @@ def build_start_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,9 +219,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +236,7 @@ def build_stop_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -273,9 +258,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +274,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -336,6 +319,9 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -366,6 +352,9 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -394,14 +383,17 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for watcher. Is either a Watcher type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.Watcher or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -422,16 +414,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Watcher") @@ -452,8 +442,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,6 +475,9 @@ def get( ) -> _models.Watcher: """Retrieve the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -506,9 +500,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) request = build_get_request( @@ -524,8 +516,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,6 +552,9 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -589,6 +585,9 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -617,14 +616,17 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -645,16 +647,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WatcherUpdateParameters") @@ -675,8 +675,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,6 +704,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the watcher by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -725,9 +729,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -743,8 +745,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,6 +770,9 @@ def start( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -789,9 +795,7 @@ def start( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -807,8 +811,9 @@ def start( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -831,6 +836,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -853,9 +861,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -871,8 +877,9 @@ def stop( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -895,6 +902,9 @@ def list_by_automation_account( ) -> Iterable["_models.Watcher"]: """Retrieve a list of watchers. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -909,9 +919,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -939,7 +947,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -955,8 +974,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py index d738fc7d1b05..e68b999548b4 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +43,7 @@ def build_generate_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +59,7 @@ def build_generate_uri_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +76,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +93,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +110,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +127,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +144,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +162,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +181,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +199,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,7 +223,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +239,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -278,6 +275,9 @@ def __init__(self, *args, **kwargs): def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: """Generates a Uri for use in creating a webhook. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -298,7 +298,7 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) request = build_generate_uri_request( @@ -313,8 +313,9 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,6 +342,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the webhook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +367,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -379,8 +383,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,6 +408,9 @@ def get( ) -> _models.Webhook: """Retrieve the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -425,7 +433,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) request = build_get_request( @@ -441,8 +449,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,6 +485,9 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -506,6 +518,9 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -534,14 +549,17 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for webhook. Is either a + WebhookCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -562,14 +580,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") @@ -590,8 +608,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,6 +648,9 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -659,6 +681,9 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,14 +712,17 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -715,14 +743,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookUpdateParameters") @@ -743,8 +771,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,6 +800,9 @@ def list_by_automation_account( ) -> Iterable["_models.Webhook"]: """Retrieve a list of webhooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -785,7 +817,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) error_map = { @@ -813,7 +845,18 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - request = HttpRequest("GET", next_link) + # 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" @@ -829,8 +872,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py index 266d0219775e..a0b58651af46 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/compilationJobStreamByJobStreamId.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/compilationJobStreamByJobStreamId.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py index 40ed8e037890..0686edb03574 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/compilationJobStreamList.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/compilationJobStreamList.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py index b5c4c5affb90..eb25b0ffab70 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/createCompilationJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createCompilationJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py index a4d2d569874f..f78d7e8d8ebe 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py index d097bf32b265..20e7c218675f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py index cca079c0d201..529ec59d3f40 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py index 03a424b2e7db..9f942a1d7d6a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py index 184d6e8603ad..405519100ef8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py index 2fa852a415c4..22d8d9861978 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateCredential.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateCredential.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py index 73adef8439d4..c9fa8d477d0c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py index 5b8c55268bcb..68b1a625d50e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py index 591f109ce076..34890a16f33a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py index 7a9980c27184..3424a42793f2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdatePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdatePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py index 05ebdbeca55d..44c0116c7653 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdatePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdatePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py index 19499d40910d..87f9c611b379 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py index 78e18fc4d9d0..dfb46387b363 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py index 666c1997f5ad..52001dd03be5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/createOrUpdateWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py index 13956bc41682..256adbbe70f4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateWebhook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/createOrUpdateWebhook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py index e20284362dff..53fdd1a569ea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.automation_account.delete( + client.automation_account.delete( resource_group_name="rg", automation_account_name="myAutomationAccount9", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py index 61fd5294d6ec..292376a90648 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.certificate.delete( + client.certificate.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", certificate_name="testCert", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py index a3a0ad565068..71e3e3a8cfd4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.connection.delete( + client.connection.delete( resource_group_name="rg", automation_account_name="myAutomationAccount28", connection_name="myConnection", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py index f929c0d808aa..45db394ffe48 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.connection_type.delete( + client.connection_type.delete( resource_group_name="rg", automation_account_name="myAutomationAccount22", connection_type_name="myCT", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py index 798b2233ab98..df0d805a1ba0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.credential.delete( + client.credential.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", credential_name="myCredential", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteCredentialExisting.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteCredentialExisting.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py index 4f6167ad95e6..1f1524e273f5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.dsc_configuration.delete( + client.dsc_configuration.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", configuration_name="TemplateBasic", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py index 6ba11c5dd893..44e25ce950c6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.dsc_node.delete( + client.dsc_node.delete( resource_group_name="rg", automation_account_name="myAutomationAccount9", node_id="e1243a76-a9bd-432f-bde3-ad8f317ee786", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/deleteDscNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteDscNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py index 986c71cb656b..f93ff208e990 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.dsc_node_configuration.delete( + client.dsc_node_configuration.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", node_configuration_name="configName.nodeConfigName", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py index d57ea4f58b6c..25f9111ffcab 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.hybrid_runbook_workers.delete( + client.hybrid_runbook_workers.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", hybrid_runbook_worker_group_name="myGroup", hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py index d2756c5337d4..b28c4a1195b7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.hybrid_runbook_worker_group.delete( + client.hybrid_runbook_worker_group.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", hybrid_runbook_worker_group_name="myGroup", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py index 8a4366dc6e0d..fa18d758d25b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.job_schedule.delete( + client.job_schedule.delete( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", job_schedule_id="0fa462ba-3aa2-4138-83ca-9ebc3bc55cdc", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py index 3758f7cbd3b2..d859adf52657 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.module.delete( + client.module.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", module_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py index ba772b1f15c1..78bdf1716744 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.python2_package.delete( + client.python2_package.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", package_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deletePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deletePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py index 49b6c157e7ce..f5ca36b078ba 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.python3_package.delete( + client.python3_package.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", package_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deletePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deletePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py index e4bbe77ff19a..f455cfb0ffa7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.schedule.delete( + client.schedule.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", schedule_name="mySchedule", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py index 373381e793b3..3465944c25ba 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.variable.delete( + client.variable.delete( resource_group_name="rg", automation_account_name="sampleAccount9", variable_name="sampleVariable", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py index 0c14c65c24c2..63e269975cdc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.watcher.delete( + client.watcher.delete( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/deleteWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py index 5998a5bd524d..5b506f511ef0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.webhook.delete( + client.webhook.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", webhook_name="TestWebhook", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteWebhook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deleteWebhook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py index d83ec664e049..126e999475c7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deserializeGraphRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/deserializeGraphRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py index 9389529266ad..e7b7124330a2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getActivityInAModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getActivityInAModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py index 7ef428702a29..3e0b79ed0706 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getAgentRegistration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getAgentRegistration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py index b14fe70e2f5f..a36bb66eba49 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllConnectionTypes_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getAllConnectionTypes_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py index 9967b3c5b03a..890685a3f287 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllConnectionTypes_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getAllConnectionTypes_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py index c45e1be72dac..65f6a977b643 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllDscConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getAllDscConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py index 6b9e268ad6a3..433f0004f738 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py index 59c87b0d969e..acdf4604de59 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py index ef88aa7d757e..82daa3096911 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getCompilationJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getCompilationJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py index 9b0cecd3799f..b621496d660f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py index ef0bc7206051..4376392cc9bc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py index a3ea4858bc15..b559a897bd15 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getCredential.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getCredential.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py index 5cf4398a5e57..85dee7b1562d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-01-31/examples/getDeletedAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDeletedAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py index dd59173f3450..4d65fffd83a8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py index 3ebfcdc0e0b5..1efa40009d0b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscConfigurationContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscConfigurationContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py index f0112c52c5b7..673cd0637c73 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py index 16614b7e7da9..848e0b4db072 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py index 6e23677c4bc8..e1846d531cc8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNodeReport.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscNodeReport.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py index f2f0eac20d9d..ef293fa2cc32 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNodeReportContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getDscNodeReportContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py index ec122cfc5619..e7360d73eff3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py index 49284fc381f8..b04697084172 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py index 6658c782f8d4..4851d6238aec 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py index bfa741d8eae9..49e592e97a6b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getLinkedWorkspace.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getLinkedWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py index d6ea2e7fa7c7..1805cd6b3cef 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py index 47346472da18..31351bdf0e45 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPagedDscConfigurationsWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getPagedDscConfigurationsWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py index 5ab5913776cd..e13322dd560d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPagedlDscConfigurationsWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getPagedlDscConfigurationsWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py index 684fdc7d4b62..4d202c869e03 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getPython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py index ba09a760e5f5..a9dd44227017 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getPython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py index 9b5f8c045edb..eee9750995eb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py index 41a7706999b7..d0bd671a1818 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getStatisticsOfAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getStatisticsOfAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py index a083999ca85d..50f0826403f2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getUsagesOfAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getUsagesOfAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py index ad8209775320..64da6fb8a6d1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py index eb369835683f..3c10d347709a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py index 10fc19f864e3..cc9d768e6ea4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getWebhook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/getWebhook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py index 2d38fea8ffe7..8bec2476239d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/createJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/createJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py index d2b92f137f87..f47abd56e952 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/getJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py index 42e27376f357..e84f4672edca 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobOutput.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/getJobOutput.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py index e9c2654c74f6..6847c127a465 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/getJobRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py index f45ea43108fe..ec98aa07e145 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobStream.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/getJobStream.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py index 459c3da81dae..c280209542af 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/listJobStreamsByJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/listJobStreamsByJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py similarity index 90% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py index d789ee010ee9..b600a25375ea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py @@ -31,12 +31,12 @@ def main(): response = client.job.list_by_automation_account( resource_group_name="mygroup", - automation_account_name="ContoseAutomationAccount", + automation_account_name="ContosoAutomationAccount", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/listJobsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/listJobsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py index 9f6449d75dcf..383f0c65ddda 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.resume( + client.job.resume( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/resumeJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/resumeJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py index b918877a09be..7f4b18dbd312 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.stop( + client.job.stop( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/stopJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/stopJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py index 8d989be033b9..32a40fdee4c3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.suspend( + client.job.suspend( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/suspendJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/job/suspendJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py index 8872546354af..53aadeaf300d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listActivitiesByModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listActivitiesByModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py index 7e9f6396e600..0148ecdf7820 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listAllDscNodesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAllDscNodesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py index e81e9a773167..72d4b408d985 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAllJobSchedulesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAllJobSchedulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py new file mode 100644 index 000000000000..9627850d5eb0 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python list_automation_account_deleted_runbooks.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.automation_account.list_deleted_runbooks( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAutomationAccountDeletedRunbooks.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py index d022dd606657..0e89ad51597e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountKeys.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAutomationAccountKeys.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py index a2cf160943a9..24cba178efef 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountsByResourceGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAutomationAccountsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py index 329c56d5574a..496f89270648 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountsBySubscription.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listAutomationAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py index 28b8a613718b..5bbc732be648 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCertificatesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listCertificatesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py index 13a9c44e34b2..a1ba4ef52b87 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listCompilationJobsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listCompilationJobsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py index 34c9575d04a3..5143ba24e063 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listConnectionsByAutomationAccount_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listConnectionsByAutomationAccount_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py index 9d8e1e180083..15b08880d6c7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listConnectionsByAutomationAccount_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listConnectionsByAutomationAccount_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py index f150c3673d51..e0bb139fdcda 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCredentialsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listCredentialsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py index 566095cbdb7e..7f12961ac1d3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCredentialsByAutomationAccount_next100_using_nextLink.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listCredentialsByAutomationAccount_next100_using_nextLink.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py index a6f3b787db2f..b7ef7e637e67 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listDscNodeConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listDscNodeConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py index 96fb43eeaf63..5747b49e8dfa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listDscNodeReportsByNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listDscNodeReportsByNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py index 4bf336a82996..962c502cbe55 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listFieldsByModuleAndType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listFieldsByModuleAndType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py index 75f28c225d50..eb9162b45064 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listFieldsByType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listFieldsByType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py index 771cdcde2d4a..d768e42ab444 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py index 44a1342f3965..85ae0963874f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py index 5f8e7099d1cc..ad4419c29677 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listModulesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listModulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py index 00dc38d933a5..d6aba943db32 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeConfigurationCounts.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodeConfigurationCounts.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py index 3a69b16cabe5..ba9bea901efc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPagedDscNodeConfigurationsWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodeConfigurationsWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py index f82ff1046dbb..32aa0c5cd9f2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPagedDscNodeConfigurationsWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodeConfigurationsWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py index e6b853a64dca..a80d00458657 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeReportsByNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodeReportsByNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py index efd35d5de8f3..be873c54d534 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeStatusCounts.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodeStatusCounts.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py index cf51a4248030..df50792f659c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithCompositeFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithCompositeFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py index af954a3f052e..048bf3dfdebd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py index 2f83d3a9caf1..7632ef0789bb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py index 2c8109fa4783..c7257c9aebf6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationCustomFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationCustomFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py index f9d5fc342da0..f871bbd8b205 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationNotAssignedFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationNotAssignedFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py index 9291dc66dcba..5b7d1011a8ab 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithStatusFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithStatusFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py index 19b97ee3fc9e..0a21d7797d5d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithVersionFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPagedDscNodesByAutomationAccountWithVersionFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py index 45ce29531a20..bf49ba0cf860 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPython2PackagesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPython2PackagesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py index 544c0f4b875f..5a65ef47b3bf 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPython3PackagesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listPython3PackagesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py index d3caf91dba22..0c1e54e5874d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listRestAPIOperations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listRestAPIOperations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py index 1730bf20bf6e..cdf56c54f53d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listSchedulesByAutomationAccount_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listSchedulesByAutomationAccount_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py index 2fb56d713471..660857aa8851 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listSchedulesByAutomationAccount_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listSchedulesByAutomationAccount_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py index 27441076e4cc..c0b6b9901cc9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listVariables_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listVariables_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py index 8e2c68a5a40e..d2ff701ade34 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listVariables_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listVariables_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py index 2528b0b12062..e2d496e5d5e4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listWatchersByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listWatchersByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py index 6310c3de2131..dc6b39e5ab2c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listWebhooksByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/listWebhooksByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py new file mode 100644 index 000000000000..0d9fdce25aeb --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python move_hybrid_runbook_worker.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.hybrid_runbook_workers.move( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "TestHybridGroup2"}, + ) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/moveHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/package/create_or_update_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/package/create_or_update_package.py new file mode 100644 index 000000000000..954b99fa9653 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/package/create_or_update_package.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python create_or_update_package.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.package.create_or_update( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", + }, + "uri": "https://teststorage.blob.core.windows.net/dsccomposite/OmsCompositeResources.zip", + "version": "1.0.0.0", + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/package/createOrUpdatePackage.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/package/delete_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/package/delete_package.py new file mode 100644 index 000000000000..be19acb44ed7 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/package/delete_package.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python delete_package.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.package.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + ) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/package/deletePackage.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/package/get_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/package/get_package.py new file mode 100644 index 000000000000..b5b2e66f6584 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/package/get_package.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python get_package.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.package.get( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/package/getPackage.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/package/list_packages_by_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/package/list_packages_by_runtime_environment.py new file mode 100644 index 000000000000..f0aed50cf0b7 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/package/list_packages_by_runtime_environment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python list_packages_by_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.packages.list_by_runtime_environment( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/package/listPackagesByRuntimeEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/package/update_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/package/update_package.py new file mode 100644 index 000000000000..d92598ad6334 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/package/update_package.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python update_package.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.package.update( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", + }, + "uri": "https://teststorage.blob.core.windows.net/mycontainer/MyModule.zip", + "version": "1.0.0.0", + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/package/updatePackage.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py new file mode 100644 index 000000000000..a590883c1ea8 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python patch_hybrid_runbook_worker.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_workers.patch( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/patchHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_delete.py similarity index 86% rename from sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py rename to sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_delete.py index 90667792d25a..559e905b3b1e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.private_endpoint_connections.begin_delete( + client.private_endpoint_connections.begin_delete( resource_group_name="rg1", - automation_account_name="ddb1", + automation_account_name="automationAccountName", private_endpoint_connection_name="privateEndpointConnectionName", ).result() - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/privateEndpointConnection/PrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_get.py similarity index 89% rename from sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py rename to sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_get.py index 12f93405791d..ff4a62316fad 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_get.py @@ -31,12 +31,12 @@ def main(): response = client.private_endpoint_connections.get( resource_group_name="rg1", - automation_account_name="ddb1", + automation_account_name="automationAccountName", private_endpoint_connection_name="privateEndpointConnectionName", ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/privateEndpointConnection/PrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_list_get.py similarity index 89% rename from sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py rename to sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_list_get.py index d0b2839a11d7..ac26ddae033b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_list_get.py @@ -31,12 +31,12 @@ def main(): response = client.private_endpoint_connections.list_by_automation_account( resource_group_name="rg1", - automation_account_name="ddb1", + automation_account_name="automationAccountName", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionListGet.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/privateEndpointConnection/PrivateEndpointConnectionListGet.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_update.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py rename to sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_update.py index 62eada24990f..ca9c3bb262cd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection/private_endpoint_connection_update.py @@ -31,7 +31,7 @@ def main(): response = client.private_endpoint_connections.begin_create_or_update( resource_group_name="rg1", - automation_account_name="ddb1", + automation_account_name="automationAccountName", private_endpoint_connection_name="privateEndpointConnectionName", parameters={ "properties": { @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/privateEndpointConnection/PrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py index 751f640d36c5..a36e2731e569 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py @@ -26,17 +26,17 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="subid", ) response = client.private_link_resources.automation( resource_group_name="rg1", - automation_account_name="ddb1", + automation_account_name="testaccount", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateLinkResourceListGet.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/PrivateLinkResourceListGet.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py new file mode 100644 index 000000000000..78afc4d7b504 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_workers.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_creation_parameters={ + "properties": { + "vmResourceId": "/subscriptions/vmsubid/resourceGroups/vmrg/providers/Microsoft.Compute/virtualMachines/vmname" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/putHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py new file mode 100644 index 000000000000..819caa774a77 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_worker_group.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_group_creation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialName"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/putHybridRunbookWorkerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py b/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py index 134d188f4fb3..14e2aa5683da 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/regenerateAgentRegistrationKey.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/regenerateAgentRegistrationKey.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_or_update_runbook.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_or_update_runbook.py index 3b8805b3d1b3..d6dcde2bfcca 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_or_update_runbook.py @@ -48,7 +48,8 @@ def main(): }, "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1", }, - "runbookType": "PowerShellWorkflow", + "runbookType": "PowerShell", + "runtimeEnvironment": "environmentName", }, "tags": {"tag01": "value01", "tag02": "value02"}, }, @@ -56,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/createOrUpdateRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_runbook_as_draft.py similarity index 90% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_runbook_as_draft.py index fc334f9f9b23..91b0d5d3df34 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_runbook_as_draft.py @@ -41,7 +41,8 @@ def main(): "draft": {}, "logProgress": False, "logVerbose": False, - "runbookType": "PowerShellWorkflow", + "runbookType": "PowerShell", + "runtimeEnvironment": "environmentName", }, "tags": {"tag01": "value01", "tag02": "value02"}, }, @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createRunbookAsDraft.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/createRunbookAsDraft.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_test_job.py similarity index 85% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_test_job.py index e1c7d4e9df5b..d2aca06668b7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/create_test_job.py @@ -33,11 +33,15 @@ def main(): resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", - parameters={"parameters": {"key01": "value01", "key02": "value02"}, "runOn": ""}, + parameters={ + "parameters": {"key01": "value01", "key02": "value02"}, + "runOn": "", + "runtimeEnvironment": "runtimeEnvironmentName", + }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/createTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/delete_runbook.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/delete_runbook.py index bd4aeccefb63..19efee169916 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/delete_runbook.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.runbook.delete( + client.runbook.delete( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/deleteRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook.py index 6e699bb34e43..ed2c571068c9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_content.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_content.py index a90309a5ab22..74f55d8e4abf 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft.py index aab64bc644a7..dd63de5ac773 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookDraft.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getRunbookDraft.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft_content.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft_content.py index 0b9a52aad808..f47bc7958a70 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_runbook_draft_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookDraftContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getRunbookDraftContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job.py index d604bce10343..bd4c702340d0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job_stream.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job_stream.py index 2ac192c8a19b..f27f5a8b2c2f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/get_test_job_stream.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getTestJobStream.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/getTestJobStream.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_runbooks_by_automation_account.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_runbooks_by_automation_account.py index a2cd89a2b95c..e80c8d5bbbf2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_runbooks_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listRunbooksByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/listRunbooksByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_test_job_streams_by_job.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_test_job_streams_by_job.py index 0be9152ac743..54e76ac10b59 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/list_test_job_streams_by_job.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listTestJobStreamsByJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/listTestJobStreamsByJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/publish_runbook.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/publish_runbook.py index 8b27533bda34..e84c9cdc6502 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/publish_runbook.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.runbook.begin_publish( + client.runbook.begin_publish( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ).result() - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/publishRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/publishRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/replace_runbook_draft_content.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/replace_runbook_draft_content.py index 7d5faf92e036..a23f3707fc58 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/replace_runbook_draft_content.py @@ -34,7 +34,7 @@ def main(): automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", runbook_content="""<# - .DESCRIPTION + .DESCRIPTION An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically). For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/replaceRunbookDraftContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/replaceRunbookDraftContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/resume_test_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/resume_test_job.py index 793545c2a9b7..0b68165c90ae 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/resume_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.resume( + client.test_job.resume( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/resumeTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/resumeTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/stop_test_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/stop_test_job.py index e70cbf68bc08..14e18d2fae7b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/stop_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.stop( + client.test_job.stop( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/stopTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/stopTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/suspend_test_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/suspend_test_job.py index e01ba8626e41..25c3897a17dc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/suspend_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.suspend( + client.test_job.suspend( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/suspendTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/suspendTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/undo_draft_edit_to_last_known_published_state.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/undo_draft_edit_to_last_known_published_state.py index 47373562cc35..3235ab4e29fa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/undo_draft_edit_to_last_known_published_state.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/undoDraftEditToLastKnownPublishedState.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/undoDraftEditToLastKnownPublishedState.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/update_runbook.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py rename to sdk/automation/azure-mgmt-automation/generated_samples/runbook/update_runbook.py index 418a89a0de11..355b1a3b7b24 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runbook/update_runbook.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runbook/updateRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/create_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/create_runtime_environment.py new file mode 100644 index 000000000000..e15ace7bac6c --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/create_runtime_environment.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python create_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.runtime_environments.create( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + parameters={ + "location": "East US 2", + "properties": {"defaultPackages": {"Az": "6.*"}, "runtime": {"language": "PowerShell", "version": "7.1"}}, + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runtimeEnvironment/createRuntimeEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/delete_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/delete_runtime_environment.py new file mode 100644 index 000000000000..3504cfaeb460 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/delete_runtime_environment.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python delete_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.runtime_environments.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + ) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runtimeEnvironment/deleteRuntimeEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/get_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/get_runtime_environment.py new file mode 100644 index 000000000000..00ca50aae056 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/get_runtime_environment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python get_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.runtime_environments.get( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runtimeEnvironment/getRuntimeEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/list_runtime_environments_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/list_runtime_environments_by_automation_account.py new file mode 100644 index 000000000000..c4dcf1e0b920 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/list_runtime_environments_by_automation_account.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python list_runtime_environments_by_automation_account.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.runtime_environments.list_by_automation_account( + resource_group_name="rg", + automation_account_name="ContoseAutomationAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runtimeEnvironment/listRuntimeEnvironmentsByAutomationAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/update_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/update_runtime_environment.py new file mode 100644 index 000000000000..528df4236c09 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/runtime_environment/update_runtime_environment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python update_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.runtime_environments.update( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + parameters={"properties": {"defaultPackages": {"Az": "6.*"}}}, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/runtimeEnvironment/updateRuntimeEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py index 3155d622419f..d7570e06cabc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/serializeGraphRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/serializeGraphRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py similarity index 97% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py index b4771505a99e..965de37fb201 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py @@ -90,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py similarity index 88% rename from sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py index 6e2eb24b74ed..dd1ac0d8a90c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.software_update_configurations.delete( + client.software_update_configurations.delete( resource_group_name="mygroup", automation_account_name="myaccount", software_update_configuration_name="mypatch", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py index 5902d947a095..844cd11ff361 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py index b69d1cb13920..3b7b0bb1d8c5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py index 3681e8c0ae48..2b77ec9b102e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py index 58bd29fd58e4..8cc8163de939 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py index 00be7b54d8fc..2ebeb604496d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py index df87e8fd3d19..f518bd4b2412 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py index f22cd0c67707..bbc2267f14d4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py index d9a6b2e14679..0bc7b7b5cbd5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py index 69244ac61daf..f9f52d445d44 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py similarity index 87% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py index 714e153313c0..72eecee6298a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py @@ -41,10 +41,7 @@ def main(): "folderPath": "/folderOne/folderTwo", "publishRunbook": True, "repoUrl": "https://sampleUser.visualstudio.com/myProject/_git/myRepository", - "securityToken": { - "accessToken": "3a326f7a0dcd343ea58fee21f2fd5fb4c1234567", - "tokenType": "PersonalAccessToken", - }, + "securityToken": {"accessToken": "******", "tokenType": "PersonalAccessToken"}, "sourceType": "VsoGit", } }, @@ -52,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/createOrUpdateSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControl/createOrUpdateSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py similarity index 90% rename from sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py index 7d549e83d0ee..eba91845bcce 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.source_control.delete( + client.source_control.delete( resource_group_name="rg", automation_account_name="sampleAccount9", source_control_name="sampleSourceControl", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/deleteSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControl/deleteSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py index bebb7fc90935..5606509f2ca4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/getAllSourceControls.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControl/getAllSourceControls.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py similarity index 94% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py index fc9f1d72f52e..6a19351a0bed 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/getSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControl/getSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py similarity index 86% rename from sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py index 52f7e6b0d4e0..b846237e3ae5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py @@ -40,16 +40,13 @@ def main(): "description": "my description", "folderPath": "/folderOne/folderTwo", "publishRunbook": True, - "securityToken": { - "accessToken": "3a326f7a0dcd343ea58fee21f2fd5fb4c1234567", - "tokenType": "PersonalAccessToken", - }, + "securityToken": {"accessToken": "******", "tokenType": "PersonalAccessToken"}, } }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/updateSourceControl_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControl/updateSourceControl_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py index 7e7e27f90f2c..160e0e4ca958 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/createSourceControlSyncJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControlSyncJob/createSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py index 05eb87813631..b93b4031cf5a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py index ede5f897ec7d..9ce1be542e57 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/getSourceControlSyncJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControlSyncJob/getSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py similarity index 93% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py index 6f515733f06d..d3af6bd4fd58 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py index 2a00b6994279..d4cf4df856e8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py index 7662d25930d7..ff25822cf82f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.watcher.start( + client.watcher.start( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/startWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/startWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py index f71ada541e02..146296093013 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.watcher.stop( + client.watcher.stop( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/stopWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/stopWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py index d7b16ce92a58..ced57b8e0ab2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py index 99ab885a839a..abae5315d80c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py index 8d80714883df..be06f5d45d20 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py index b625492a573a..baeb4c578686 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateCredential_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateCredential_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py index e094bac82453..6f04d86ee73e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py index f16476b7c162..30566ad8cc60 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/updateDscNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateDscNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py new file mode 100644 index 000000000000..e3bfd702d385 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python update_hybrid_runbook_worker_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_worker_group.update( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_group_updation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialUpdatedName"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateHybridRunbookWorkerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py index ccb620b512db..b2d400e9fd52 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py index 64b2e32508bb..a9bac5f138a8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updatePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updatePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py index 862d22b3f059..7f6ae226f750 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updatePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updatePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py index 1f105f8835d7..5a4ecf8b5f82 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py index 36c587ab42b9..bd2870c33cb6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateVariable_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateVariable_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py index 050ed96d68e6..2db5ee1cd649 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/updateWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py index 40a8e43c20ef..d2734d45f605 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateWebhook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/updateWebhook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py b/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py index 82cda65e5013..2e36044ce340 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/webhookGenerateUri.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2023-05-15-preview/examples/webhookGenerateUri.json if __name__ == "__main__": main()