diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/_meta.json b/sdk/streamanalytics/azure-mgmt-streamanalytics/_meta.json index 9ecc2a71e645..26b632608919 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/_meta.json +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "0ca8399b0e4fb4ae4608ffd0a6c056213664dacd", + "commit": "58a1320584b1d26bf7dab969a2593cd22b39caec", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/streamanalytics/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/streamanalytics/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/streamanalytics/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/__init__.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/__init__.py index 8d459f9a001f..4b5390dee816 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/__init__.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['StreamAnalyticsManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_configuration.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_configuration.py index 93696b9ba2dc..e593c0d584c6 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_configuration.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class StreamAnalyticsManagementClientConfiguration(Configuration): +class StreamAnalyticsManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StreamAnalyticsManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class StreamAnalyticsManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(StreamAnalyticsManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-streamanalytics/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_metadata.json b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_metadata.json deleted file mode 100644 index 7cf93e4b6c02..000000000000 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_metadata.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "chosen_version": "2020-03-01", - "total_api_version_list": ["2020-03-01"], - "client": { - "name": "StreamAnalyticsManagementClient", - "filename": "_stream_analytics_management_client", - "description": "Stream Analytics Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StreamAnalyticsManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StreamAnalyticsManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "streaming_jobs": "StreamingJobsOperations", - "inputs": "InputsOperations", - "outputs": "OutputsOperations", - "transformations": "TransformationsOperations", - "functions": "FunctionsOperations", - "subscriptions": "SubscriptionsOperations", - "clusters": "ClustersOperations", - "private_endpoints": "PrivateEndpointsOperations" - } -} \ No newline at end of file diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_stream_analytics_management_client.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_stream_analytics_management_client.py index aa0fbce8834f..a24867652d20 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_stream_analytics_management_client.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_stream_analytics_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import StreamAnalyticsManagementClientConfiguration @@ -21,35 +22,36 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StreamAnalyticsManagementClient: +class StreamAnalyticsManagementClient: # pylint: disable=too-many-instance-attributes """Stream Analytics Client. :ivar operations: Operations operations - :vartype operations: stream_analytics_management_client.operations.Operations + :vartype operations: azure.mgmt.streamanalytics.operations.Operations :ivar streaming_jobs: StreamingJobsOperations operations - :vartype streaming_jobs: stream_analytics_management_client.operations.StreamingJobsOperations + :vartype streaming_jobs: azure.mgmt.streamanalytics.operations.StreamingJobsOperations :ivar inputs: InputsOperations operations - :vartype inputs: stream_analytics_management_client.operations.InputsOperations + :vartype inputs: azure.mgmt.streamanalytics.operations.InputsOperations :ivar outputs: OutputsOperations operations - :vartype outputs: stream_analytics_management_client.operations.OutputsOperations + :vartype outputs: azure.mgmt.streamanalytics.operations.OutputsOperations :ivar transformations: TransformationsOperations operations - :vartype transformations: - stream_analytics_management_client.operations.TransformationsOperations + :vartype transformations: azure.mgmt.streamanalytics.operations.TransformationsOperations :ivar functions: FunctionsOperations operations - :vartype functions: stream_analytics_management_client.operations.FunctionsOperations + :vartype functions: azure.mgmt.streamanalytics.operations.FunctionsOperations :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: stream_analytics_management_client.operations.SubscriptionsOperations + :vartype subscriptions: azure.mgmt.streamanalytics.operations.SubscriptionsOperations :ivar clusters: ClustersOperations operations - :vartype clusters: stream_analytics_management_client.operations.ClustersOperations + :vartype clusters: azure.mgmt.streamanalytics.operations.ClustersOperations :ivar private_endpoints: PrivateEndpointsOperations operations - :vartype private_endpoints: - stream_analytics_management_client.operations.PrivateEndpointsOperations + :vartype private_endpoints: azure.mgmt.streamanalytics.operations.PrivateEndpointsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -68,20 +70,38 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.streaming_jobs = StreamingJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.inputs = InputsOperations(self._client, self._config, self._serialize, self._deserialize) - self.outputs = OutputsOperations(self._client, self._config, self._serialize, self._deserialize) - self.transformations = TransformationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.functions = FunctionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoints = PrivateEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.streaming_jobs = StreamingJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inputs = InputsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.outputs = OutputsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.transformations = TransformationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions = FunctionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoints = PrivateEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_version.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_version.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/__init__.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/__init__.py index a23c47af3d77..d64618e58ebf 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/__init__.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._stream_analytics_management_client import StreamAnalyticsManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['StreamAnalyticsManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_configuration.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_configuration.py index e5b4066e7159..d048831f9b6d 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_configuration.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class StreamAnalyticsManagementClientConfiguration(Configuration): +class StreamAnalyticsManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StreamAnalyticsManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class StreamAnalyticsManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(StreamAnalyticsManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-streamanalytics/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_stream_analytics_management_client.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_stream_analytics_management_client.py index 087a69a6403c..e901d3f89348 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_stream_analytics_management_client.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/_stream_analytics_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import StreamAnalyticsManagementClientConfiguration @@ -21,37 +22,37 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StreamAnalyticsManagementClient: +class StreamAnalyticsManagementClient: # pylint: disable=too-many-instance-attributes """Stream Analytics Client. :ivar operations: Operations operations - :vartype operations: stream_analytics_management_client.aio.operations.Operations + :vartype operations: azure.mgmt.streamanalytics.aio.operations.Operations :ivar streaming_jobs: StreamingJobsOperations operations - :vartype streaming_jobs: - stream_analytics_management_client.aio.operations.StreamingJobsOperations + :vartype streaming_jobs: azure.mgmt.streamanalytics.aio.operations.StreamingJobsOperations :ivar inputs: InputsOperations operations - :vartype inputs: stream_analytics_management_client.aio.operations.InputsOperations + :vartype inputs: azure.mgmt.streamanalytics.aio.operations.InputsOperations :ivar outputs: OutputsOperations operations - :vartype outputs: stream_analytics_management_client.aio.operations.OutputsOperations + :vartype outputs: azure.mgmt.streamanalytics.aio.operations.OutputsOperations :ivar transformations: TransformationsOperations operations - :vartype transformations: - stream_analytics_management_client.aio.operations.TransformationsOperations + :vartype transformations: azure.mgmt.streamanalytics.aio.operations.TransformationsOperations :ivar functions: FunctionsOperations operations - :vartype functions: stream_analytics_management_client.aio.operations.FunctionsOperations + :vartype functions: azure.mgmt.streamanalytics.aio.operations.FunctionsOperations :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: - stream_analytics_management_client.aio.operations.SubscriptionsOperations + :vartype subscriptions: azure.mgmt.streamanalytics.aio.operations.SubscriptionsOperations :ivar clusters: ClustersOperations operations - :vartype clusters: stream_analytics_management_client.aio.operations.ClustersOperations + :vartype clusters: azure.mgmt.streamanalytics.aio.operations.ClustersOperations :ivar private_endpoints: PrivateEndpointsOperations operations :vartype private_endpoints: - stream_analytics_management_client.aio.operations.PrivateEndpointsOperations + azure.mgmt.streamanalytics.aio.operations.PrivateEndpointsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -70,15 +71,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.streaming_jobs = StreamingJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.inputs = InputsOperations(self._client, self._config, self._serialize, self._deserialize) - self.outputs = OutputsOperations(self._client, self._config, self._serialize, self._deserialize) - self.transformations = TransformationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.functions = FunctionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoints = PrivateEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.streaming_jobs = StreamingJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inputs = InputsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.outputs = OutputsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.transformations = TransformationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions = FunctionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoints = PrivateEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/__init__.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/__init__.py index 72cfdc41ec92..0a7f15bac1ac 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/__init__.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/__init__.py @@ -16,6 +16,9 @@ from ._clusters_operations import ClustersOperations from ._private_endpoints_operations import PrivateEndpointsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'StreamingJobsOperations', @@ -27,3 +30,5 @@ 'ClustersOperations', 'PrivateEndpointsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_clusters_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_clusters_operations.py index 1de006867e79..44a7ef613789 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_clusters_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,43 +27,45 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ClustersOperations: - """ClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] _json = self._serialize.body(cluster, 'Cluster') @@ -71,16 +73,23 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -98,7 +107,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace_async @@ -106,11 +115,11 @@ async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.Cluster"]: + ) -> AsyncLROPoller[_models.Cluster]: """Creates a Stream Analytics Cluster or replaces an already existing cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -119,13 +128,14 @@ async def begin_create_or_update( :type cluster_name: str :param cluster: The definition of the cluster that will be used to create a new cluster or replace the existing one. - :type cluster: ~stream_analytics_management_client.models.Cluster + :type cluster: ~azure.mgmt.streamanalytics.models.Cluster :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response. + Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -137,40 +147,52 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.Cluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.Cluster] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, cluster=cluster, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,26 +201,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore async def _update_initial( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, **kwargs: Any - ) -> Optional["_models.Cluster"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + ) -> Optional[_models.Cluster]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Cluster]] _json = self._serialize.body(cluster, 'Cluster') @@ -206,15 +231,22 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -230,7 +262,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace_async @@ -238,10 +270,10 @@ async def begin_update( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.Cluster"]: + ) -> AsyncLROPoller[_models.Cluster]: """Updates an existing cluster. This can be used to partially update (ie. update one or two properties) a cluster without affecting the rest of the cluster definition. @@ -251,10 +283,10 @@ async def begin_update( :type cluster_name: str :param cluster: The properties specified here will overwrite the corresponding properties in the existing cluster (ie. Those properties will be updated). - :type cluster: ~stream_analytics_management_client.models.Cluster + :type cluster: ~azure.mgmt.streamanalytics.models.Cluster :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -266,39 +298,51 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.Cluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.Cluster] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, cluster=cluster, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -307,10 +351,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace_async async def get( @@ -318,7 +361,7 @@ async def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.Cluster": + ) -> _models.Cluster: """Gets information about the specified cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -327,26 +370,38 @@ async def get( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Cluster + :rtype: ~azure.mgmt.streamanalytics.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -361,32 +416,44 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -396,11 +463,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -424,18 +491,25 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -445,8 +519,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -455,47 +535,57 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.ClusterListResult"]: + ) -> AsyncIterable[_models.ClusterListResult]: """Lists all of the clusters in the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.ClusterListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -509,7 +599,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -523,14 +617,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters"} # type: ignore @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClusterListResult"]: + ) -> AsyncIterable[_models.ClusterListResult]: """Lists all of the clusters in the given resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -538,34 +632,45 @@ def list_by_resource_group( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.ClusterListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -579,7 +684,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -593,7 +702,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters"} # type: ignore @distributed_trace def list_streaming_jobs( @@ -601,7 +710,7 @@ def list_streaming_jobs( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClusterJobListResult"]: + ) -> AsyncIterable[_models.ClusterJobListResult]: """Lists all of the streaming jobs in the given cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -612,14 +721,19 @@ def list_streaming_jobs( :return: An iterator like instance of either ClusterJobListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.ClusterJobListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.ClusterJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -627,10 +741,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_streaming_jobs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -638,10 +755,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -655,7 +775,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -669,4 +793,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_streaming_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs'} # type: ignore + list_streaming_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_functions_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_functions_operations.py index 7257e585966a..b00e272f5330 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_functions_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_functions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class FunctionsOperations: - """FunctionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`functions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -54,11 +52,11 @@ async def create_or_replace( resource_group_name: str, job_name: str, function_name: str, - function: "_models.Function", + function: _models.Function, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Creates a function or replaces an already existing function under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,26 +67,31 @@ async def create_or_replace( :type function_name: str :param function: The definition of the function that will be used to create a new function or replace the existing one under the streaming job. - :type function: ~stream_analytics_management_client.models.Function + :type function: ~azure.mgmt.streamanalytics.models.Function :param if_match: The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new function to be created, but to prevent updating - an existing function. Other values will result in a 412 Pre-condition Failed response. + an existing function. Other values will result in a 412 Pre-condition Failed response. Default + value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] _json = self._serialize.body(function, 'Function') @@ -97,16 +100,23 @@ async def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -130,7 +140,7 @@ async def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace_async @@ -139,10 +149,10 @@ async def update( resource_group_name: str, job_name: str, function_name: str, - function: "_models.Function", + function: _models.Function, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Updates an existing function under an existing streaming job. This can be used to partially update (ie. update one or two properties) a function without affecting the rest the job or function definition. @@ -157,23 +167,27 @@ async def update( corresponding properties in the existing function (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing function will remain the same and not change as a result of this PATCH operation. - :type function: ~stream_analytics_management_client.models.Function + :type function: ~azure.mgmt.streamanalytics.models.Function :param if_match: The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] _json = self._serialize.body(function, 'Function') @@ -182,15 +196,22 @@ async def update( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -208,11 +229,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -232,11 +253,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -244,12 +270,19 @@ async def delete( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -260,7 +293,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace_async @@ -270,7 +303,7 @@ async def get( job_name: str, function_name: str, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Gets details about the specified function. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -281,14 +314,19 @@ async def get( :type function_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] request = build_get_request( @@ -296,12 +334,19 @@ async def get( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,7 +364,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace @@ -329,7 +374,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.FunctionListResult"]: + ) -> AsyncIterable[_models.FunctionListResult]: """Lists all of the functions under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -339,18 +384,24 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FunctionListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.FunctionListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.FunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FunctionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FunctionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,11 +409,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,11 +424,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -388,7 +445,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,23 +463,27 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions"} # type: ignore async def _test_initial( self, resource_group_name: str, job_name: str, function_name: str, - function: Optional["_models.Function"] = None, + function: Optional[_models.Function] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if function is not None: _json = self._serialize.body(function, 'Function') @@ -430,14 +495,21 @@ async def _test_initial( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -453,7 +525,7 @@ async def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test"} # type: ignore @distributed_trace_async @@ -462,9 +534,9 @@ async def begin_test( resource_group_name: str, job_name: str, function_name: str, - function: Optional["_models.Function"] = None, + function: Optional[_models.Function] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.ResourceTestStatus"]: + ) -> AsyncLROPoller[_models.ResourceTestStatus]: """Tests if the information provided for a function is valid. This can range from testing the connection to the underlying web service behind the function or making sure the function code provided is syntactically correct. @@ -479,8 +551,9 @@ async def begin_test( the full function definition intended to be tested. If the function specified already exists, this parameter can be left null to test the existing function as is or if specified, the properties specified will overwrite the corresponding properties in the existing function - (exactly like a PATCH operation) and the resulting function will be tested. - :type function: ~stream_analytics_management_client.models.Function + (exactly like a PATCH operation) and the resulting function will be tested. Default value is + None. + :type function: ~azure.mgmt.streamanalytics.models.Function :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -492,39 +565,51 @@ async def begin_test( :return: An instance of AsyncLROPoller that returns either ResourceTestStatus or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_initial( + raw_result = await self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, function=function, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -533,10 +618,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test"} # type: ignore @distributed_trace_async async def retrieve_default_definition( @@ -544,9 +628,9 @@ async def retrieve_default_definition( resource_group_name: str, job_name: str, function_name: str, - function_retrieve_default_definition_parameters: Optional["_models.FunctionRetrieveDefaultDefinitionParameters"] = None, + function_retrieve_default_definition_parameters: Optional[_models.FunctionRetrieveDefaultDefinitionParameters] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Retrieves the default definition of a function based on the parameters specified. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -556,21 +640,25 @@ async def retrieve_default_definition( :param function_name: The name of the function. :type function_name: str :param function_retrieve_default_definition_parameters: Parameters used to specify the type of - function to retrieve the default definition for. + function to retrieve the default definition for. Default value is None. :type function_retrieve_default_definition_parameters: - ~stream_analytics_management_client.models.FunctionRetrieveDefaultDefinitionParameters + ~azure.mgmt.streamanalytics.models.FunctionRetrieveDefaultDefinitionParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] if function_retrieve_default_definition_parameters is not None: _json = self._serialize.body(function_retrieve_default_definition_parameters, 'FunctionRetrieveDefaultDefinitionParameters') @@ -582,14 +670,21 @@ async def retrieve_default_definition( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.retrieve_default_definition.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -604,5 +699,5 @@ async def retrieve_default_definition( return deserialized - retrieve_default_definition.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition'} # type: ignore + retrieve_default_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_inputs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_inputs_operations.py index a6f8bfe6c39c..7b06c2681fcb 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_inputs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_inputs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class InputsOperations: - """InputsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`inputs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -54,11 +52,11 @@ async def create_or_replace( resource_group_name: str, job_name: str, input_name: str, - input: "_models.Input", + input: _models.Input, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Creates an input or replaces an already existing input under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,25 +67,31 @@ async def create_or_replace( :type input_name: str :param input: The definition of the input that will be used to create a new input or replace the existing one under the streaming job. - :type input: ~stream_analytics_management_client.models.Input + :type input: ~azure.mgmt.streamanalytics.models.Input :param if_match: The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. + Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new input to be created, but to prevent updating an - existing input. Other values will result in a 412 Pre-condition Failed response. + existing input. Other values will result in a 412 Pre-condition Failed response. Default value + is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] _json = self._serialize.body(input, 'Input') @@ -96,16 +100,23 @@ async def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -129,7 +140,7 @@ async def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace_async @@ -138,10 +149,10 @@ async def update( resource_group_name: str, job_name: str, input_name: str, - input: "_models.Input", + input: _models.Input, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition. @@ -156,22 +167,27 @@ async def update( properties in the existing input (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing input will remain the same and not change as a result of this PATCH operation. - :type input: ~stream_analytics_management_client.models.Input + :type input: ~azure.mgmt.streamanalytics.models.Input :param if_match: The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. + Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] _json = self._serialize.body(input, 'Input') @@ -180,15 +196,22 @@ async def update( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,11 +229,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -230,11 +253,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -242,12 +270,19 @@ async def delete( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -258,7 +293,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace_async @@ -268,7 +303,7 @@ async def get( job_name: str, input_name: str, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Gets details about the specified input. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -279,14 +314,19 @@ async def get( :type input_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] request = build_get_request( @@ -294,12 +334,19 @@ async def get( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -317,7 +364,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace @@ -327,7 +374,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.InputListResult"]: + ) -> AsyncIterable[_models.InputListResult]: """Lists all of the inputs under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -337,18 +384,24 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either InputListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.InputListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.InputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.InputListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.InputListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -356,11 +409,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -368,11 +424,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -386,7 +445,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -400,23 +463,27 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs"} # type: ignore async def _test_initial( self, resource_group_name: str, job_name: str, input_name: str, - input: Optional["_models.Input"] = None, + input: Optional[_models.Input] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if input is not None: _json = self._serialize.body(input, 'Input') @@ -428,14 +495,21 @@ async def _test_initial( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -451,7 +525,7 @@ async def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test"} # type: ignore @distributed_trace_async @@ -460,9 +534,9 @@ async def begin_test( resource_group_name: str, job_name: str, input_name: str, - input: Optional["_models.Input"] = None, + input: Optional[_models.Input] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.ResourceTestStatus"]: + ) -> AsyncLROPoller[_models.ResourceTestStatus]: """Tests whether an input’s datasource is reachable and usable by the Azure Stream Analytics service. @@ -476,8 +550,8 @@ async def begin_test( full input definition intended to be tested. If the input specified already exists, this parameter can be left null to test the existing input as is or if specified, the properties specified will overwrite the corresponding properties in the existing input (exactly like a - PATCH operation) and the resulting input will be tested. - :type input: ~stream_analytics_management_client.models.Input + PATCH operation) and the resulting input will be tested. Default value is None. + :type input: ~azure.mgmt.streamanalytics.models.Input :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -489,39 +563,51 @@ async def begin_test( :return: An instance of AsyncLROPoller that returns either ResourceTestStatus or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_initial( + raw_result = await self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, input=input, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -530,7 +616,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_operations.py index cd934d596162..75f70e82d6a9 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ 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 @@ -25,61 +24,70 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Stream Analytics related operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.OperationListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -93,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +119,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.StreamAnalytics/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.StreamAnalytics/operations"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_outputs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_outputs_operations.py index 652f9cb13b08..012e7659510b 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_outputs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_outputs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OutputsOperations: - """OutputsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`outputs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -54,11 +52,11 @@ async def create_or_replace( resource_group_name: str, job_name: str, output_name: str, - output: "_models.Output", + output: _models.Output, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Creates an output or replaces an already existing output under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,26 +67,31 @@ async def create_or_replace( :type output_name: str :param output: The definition of the output that will be used to create a new output or replace the existing one under the streaming job. - :type output: ~stream_analytics_management_client.models.Output + :type output: ~azure.mgmt.streamanalytics.models.Output :param if_match: The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new output to be created, but to prevent updating - an existing output. Other values will result in a 412 Pre-condition Failed response. + an existing output. Other values will result in a 412 Pre-condition Failed response. Default + value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] _json = self._serialize.body(output, 'Output') @@ -97,16 +100,23 @@ async def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -130,7 +140,7 @@ async def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace_async @@ -139,10 +149,10 @@ async def update( resource_group_name: str, job_name: str, output_name: str, - output: "_models.Output", + output: _models.Output, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Updates an existing output under an existing streaming job. This can be used to partially update (ie. update one or two properties) an output without affecting the rest the job or output definition. @@ -157,23 +167,27 @@ async def update( properties in the existing output (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing output will remain the same and not change as a result of this PATCH operation. - :type output: ~stream_analytics_management_client.models.Output + :type output: ~azure.mgmt.streamanalytics.models.Output :param if_match: The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] _json = self._serialize.body(output, 'Output') @@ -182,15 +196,22 @@ async def update( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -208,11 +229,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -232,11 +253,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -244,12 +270,19 @@ async def delete( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -260,7 +293,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace_async @@ -270,7 +303,7 @@ async def get( job_name: str, output_name: str, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Gets details about the specified output. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -281,14 +314,19 @@ async def get( :type output_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] request = build_get_request( @@ -296,12 +334,19 @@ async def get( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,7 +364,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace @@ -329,7 +374,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.OutputListResult"]: + ) -> AsyncIterable[_models.OutputListResult]: """Lists all of the outputs under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -339,18 +384,24 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutputListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.OutputListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.OutputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutputListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutputListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,11 +409,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,11 +424,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -388,7 +445,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,23 +463,27 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs"} # type: ignore async def _test_initial( self, resource_group_name: str, job_name: str, output_name: str, - output: Optional["_models.Output"] = None, + output: Optional[_models.Output] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if output is not None: _json = self._serialize.body(output, 'Output') @@ -430,14 +495,21 @@ async def _test_initial( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -453,7 +525,7 @@ async def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test"} # type: ignore @distributed_trace_async @@ -462,9 +534,9 @@ async def begin_test( resource_group_name: str, job_name: str, output_name: str, - output: Optional["_models.Output"] = None, + output: Optional[_models.Output] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.ResourceTestStatus"]: + ) -> AsyncLROPoller[_models.ResourceTestStatus]: """Tests whether an output’s datasource is reachable and usable by the Azure Stream Analytics service. @@ -478,8 +550,8 @@ async def begin_test( full output definition intended to be tested. If the output specified already exists, this parameter can be left null to test the existing output as is or if specified, the properties specified will overwrite the corresponding properties in the existing output (exactly like a - PATCH operation) and the resulting output will be tested. - :type output: ~stream_analytics_management_client.models.Output + PATCH operation) and the resulting output will be tested. Default value is None. + :type output: ~azure.mgmt.streamanalytics.models.Output :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -491,39 +563,51 @@ async def begin_test( :return: An instance of AsyncLROPoller that returns either ResourceTestStatus or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_initial( + raw_result = await self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, output=output, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -532,7 +616,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_patch.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_private_endpoints_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_private_endpoints_operations.py index 8ce95c7d32f7..c70c273fe133 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_private_endpoints_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_private_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointsOperations: - """PrivateEndpointsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`private_endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_update( @@ -54,11 +52,11 @@ async def create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_name: str, - private_endpoint: "_models.PrivateEndpoint", + private_endpoint: _models.PrivateEndpoint, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.PrivateEndpoint": + ) -> _models.PrivateEndpoint: """Creates a Stream Analytics Private Endpoint or replaces an already existing Private Endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,26 +67,31 @@ async def create_or_update( :type private_endpoint_name: str :param private_endpoint: The definition of the private endpoint that will be used to create a new cluster or replace the existing one. - :type private_endpoint: ~stream_analytics_management_client.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response. + Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpoint, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.PrivateEndpoint + :rtype: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpoint] _json = self._serialize.body(private_endpoint, 'PrivateEndpoint') @@ -97,16 +100,23 @@ async def create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -125,7 +135,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace_async @@ -135,7 +145,7 @@ async def get( cluster_name: str, private_endpoint_name: str, **kwargs: Any - ) -> "_models.PrivateEndpoint": + ) -> _models.PrivateEndpoint: """Gets information about the specified Private Endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -146,14 +156,19 @@ async def get( :type private_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpoint, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.PrivateEndpoint + :rtype: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpoint] request = build_get_request( @@ -161,12 +176,19 @@ async def get( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,21 +203,26 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, private_endpoint_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -203,12 +230,19 @@ async def _delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -218,11 +252,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -249,19 +283,26 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -271,8 +312,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -281,10 +328,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace def list_by_cluster( @@ -292,7 +338,7 @@ def list_by_cluster( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointListResult]: """Lists the private endpoints in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -303,14 +349,19 @@ def list_by_cluster( :return: An iterator like instance of either PrivateEndpointListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.PrivateEndpointListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.PrivateEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -318,10 +369,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -329,10 +383,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -346,7 +403,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -360,4 +421,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_streaming_jobs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_streaming_jobs_operations.py index 6776ea16d840..f33144c72a32 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_streaming_jobs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_streaming_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -27,43 +27,45 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class StreamingJobsOperations: - """StreamingJobsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`streaming_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _create_or_replace_initial( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] + ) -> _models.StreamingJob: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] _json = self._serialize.body(streaming_job, 'StreamingJob') @@ -71,16 +73,23 @@ async def _create_or_replace_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self._create_or_replace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -103,7 +112,7 @@ async def _create_or_replace_initial( return deserialized - _create_or_replace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + _create_or_replace_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace_async @@ -111,11 +120,11 @@ async def begin_create_or_replace( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.StreamingJob"]: + ) -> AsyncLROPoller[_models.StreamingJob]: """Creates a streaming job or replaces an already existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -124,14 +133,14 @@ async def begin_create_or_replace( :type job_name: str :param streaming_job: The definition of the streaming job that will be used to create a new streaming job or replace the existing one. - :type streaming_job: ~stream_analytics_management_client.models.StreamingJob + :type streaming_job: ~azure.mgmt.streamanalytics.models.StreamingJob :param if_match: The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new streaming job to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed - response. + response. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -143,27 +152,33 @@ async def begin_create_or_replace( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StreamingJob or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~stream_analytics_management_client.models.StreamingJob] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.streamanalytics.models.StreamingJob] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_replace_initial( + raw_result = await self._create_or_replace_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, streaming_job=streaming_job, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -179,8 +194,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -189,20 +210,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + begin_create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace_async async def update( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": + ) -> _models.StreamingJob: """Updates an existing streaming job. This can be used to partially update (ie. update one or two properties) a streaming job without affecting the rest the job definition. @@ -214,23 +234,27 @@ async def update( corresponding properties in the existing streaming job (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing input will remain the same and not change as a result of this PATCH operation. - :type streaming_job: ~stream_analytics_management_client.models.StreamingJob + :type streaming_job: ~azure.mgmt.streamanalytics.models.StreamingJob :param if_match: The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StreamingJob, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.StreamingJob + :rtype: ~azure.mgmt.streamanalytics.models.StreamingJob :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] _json = self._serialize.body(streaming_job, 'StreamingJob') @@ -238,15 +262,22 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -264,32 +295,44 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -299,11 +342,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -327,18 +370,25 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -348,8 +398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -358,10 +414,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace_async async def get( @@ -370,7 +425,7 @@ async def get( job_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": + ) -> _models.StreamingJob: """Gets details about the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -380,31 +435,43 @@ async def get( :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StreamingJob, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.StreamingJob + :rtype: ~azure.mgmt.streamanalytics.models.StreamingJob :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -422,7 +489,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace @@ -431,7 +498,7 @@ def list_by_resource_group( resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.StreamingJobListResult"]: + ) -> AsyncIterable[_models.StreamingJobListResult]: """Lists all of the streaming jobs in the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -439,42 +506,53 @@ def list_by_resource_group( :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StreamingJobListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.StreamingJobListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.StreamingJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, expand=expand, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, expand=expand, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -488,7 +566,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,53 +584,64 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs"} # type: ignore @distributed_trace def list( self, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.StreamingJobListResult"]: + ) -> AsyncIterable[_models.StreamingJobListResult]: """Lists all of the streaming jobs in the given subscription. :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StreamingJobListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~stream_analytics_management_client.models.StreamingJobListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.streamanalytics.models.StreamingJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -562,7 +655,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,22 +673,26 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - start_job_parameters: Optional["_models.StartStreamingJobParameters"] = None, + start_job_parameters: Optional[_models.StartStreamingJobParameters] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] if start_job_parameters is not None: _json = self._serialize.body(start_job_parameters, 'StartStreamingJobParameters') @@ -602,14 +703,21 @@ async def _start_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -619,15 +727,15 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - start_job_parameters: Optional["_models.StartStreamingJobParameters"] = None, + start_job_parameters: Optional[_models.StartStreamingJobParameters] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Starts a streaming job. Once a job is started it will start processing input events and produce @@ -637,9 +745,9 @@ async def begin_start( :type resource_group_name: str :param job_name: The name of the streaming job. :type job_name: str - :param start_job_parameters: Parameters applicable to a start streaming job operation. - :type start_job_parameters: - ~stream_analytics_management_client.models.StartStreamingJobParameters + :param start_job_parameters: Parameters applicable to a start streaming job operation. Default + value is None. + :type start_job_parameters: ~azure.mgmt.streamanalytics.models.StartStreamingJobParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -652,21 +760,28 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, start_job_parameters=start_job_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -676,8 +791,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -686,34 +807,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -723,11 +855,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -752,18 +884,25 @@ async def begin_stop( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -773,8 +912,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -783,25 +928,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop"} # type: ignore - async def _scale_initial( + async def _scale_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - scale_job_parameters: Optional["_models.ScaleStreamingJobParameters"] = None, + scale_job_parameters: Optional[_models.ScaleStreamingJobParameters] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] if scale_job_parameters is not None: _json = self._serialize.body(scale_job_parameters, 'ScaleStreamingJobParameters') @@ -812,14 +960,21 @@ async def _scale_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._scale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -829,15 +984,15 @@ async def _scale_initial( if cls: return cls(pipeline_response, None, {}) - _scale_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale'} # type: ignore + _scale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale"} # type: ignore @distributed_trace_async - async def begin_scale( + async def begin_scale( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - scale_job_parameters: Optional["_models.ScaleStreamingJobParameters"] = None, + scale_job_parameters: Optional[_models.ScaleStreamingJobParameters] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Scales a streaming job when the job is running. @@ -846,9 +1001,9 @@ async def begin_scale( :type resource_group_name: str :param job_name: The name of the streaming job. :type job_name: str - :param scale_job_parameters: Parameters applicable to a scale streaming job operation. - :type scale_job_parameters: - ~stream_analytics_management_client.models.ScaleStreamingJobParameters + :param scale_job_parameters: Parameters applicable to a scale streaming job operation. Default + value is None. + :type scale_job_parameters: ~azure.mgmt.streamanalytics.models.ScaleStreamingJobParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -861,21 +1016,28 @@ async def begin_scale( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._scale_initial( + raw_result = await self._scale_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, scale_job_parameters=scale_job_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -885,8 +1047,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -895,7 +1063,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale'} # type: ignore + begin_scale.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_subscriptions_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_subscriptions_operations.py index 1c779379caaf..03c5b2021355 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_subscriptions_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_subscriptions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 @@ -23,33 +23,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SubscriptionsOperations: - """SubscriptionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`subscriptions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list_quotas( self, location: str, **kwargs: Any - ) -> "_models.SubscriptionQuotasListResult": + ) -> _models.SubscriptionQuotasListResult: """Retrieves the subscription's current quota information in a particular region. :param location: The region in which to retrieve the subscription's quota information. You can @@ -58,25 +56,37 @@ async def list_quotas( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionQuotasListResult, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.SubscriptionQuotasListResult + :rtype: ~azure.mgmt.streamanalytics.models.SubscriptionQuotasListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionQuotasListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionQuotasListResult] request = build_list_quotas_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_quotas.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -91,5 +101,5 @@ async def list_quotas( return deserialized - list_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas'} # type: ignore + list_quotas.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_transformations_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_transformations_operations.py index a4afa53f1705..c943d45c7a03 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_transformations_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/aio/operations/_transformations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TransformationsOperations: - """TransformationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.aio.StreamAnalyticsManagementClient`'s + :attr:`transformations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -50,11 +48,11 @@ async def create_or_replace( resource_group_name: str, job_name: str, transformation_name: str, - transformation: "_models.Transformation", + transformation: _models.Transformation, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Creates a transformation or replaces an already existing transformation under an existing streaming job. @@ -66,27 +64,31 @@ async def create_or_replace( :type transformation_name: str :param transformation: The definition of the transformation that will be used to create a new transformation or replace the existing one under the streaming job. - :type transformation: ~stream_analytics_management_client.models.Transformation + :type transformation: ~azure.mgmt.streamanalytics.models.Transformation :param if_match: The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. + concurrent changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new transformation to be created, but to prevent updating an existing transformation. Other values will result in a 412 Pre-condition Failed - response. + response. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] _json = self._serialize.body(transformation, 'Transformation') @@ -95,16 +97,23 @@ async def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -128,7 +137,7 @@ async def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore @distributed_trace_async @@ -137,10 +146,10 @@ async def update( resource_group_name: str, job_name: str, transformation_name: str, - transformation: "_models.Transformation", + transformation: _models.Transformation, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Updates an existing transformation under an existing streaming job. This can be used to partially update (ie. update one or two properties) a transformation without affecting the rest the job or transformation definition. @@ -156,23 +165,27 @@ async def update( updated). Any properties that are set to null here will mean that the corresponding property in the existing transformation will remain the same and not change as a result of this PATCH operation. - :type transformation: ~stream_analytics_management_client.models.Transformation + :type transformation: ~azure.mgmt.streamanalytics.models.Transformation :param if_match: The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. + concurrent changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] _json = self._serialize.body(transformation, 'Transformation') @@ -181,15 +194,22 @@ async def update( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -207,7 +227,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore @distributed_trace_async @@ -217,7 +237,7 @@ async def get( job_name: str, transformation_name: str, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Gets details about the specified transformation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -228,14 +248,19 @@ async def get( :type transformation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] request = build_get_request( @@ -243,12 +268,19 @@ async def get( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -266,5 +298,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/__init__.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/__init__.py index cc323de0b32e..4e2ebb2ea2bc 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/__init__.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/__init__.py @@ -6,9 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import AggregateFunctionProperties from ._models_py3 import AvroSerialization from ._models_py3 import AzureDataLakeStoreOutputDataSource from ._models_py3 import AzureDataLakeStoreOutputDataSourceProperties +from ._models_py3 import AzureFunctionOutputDataSource from ._models_py3 import AzureMachineLearningWebServiceFunctionBinding from ._models_py3 import AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters from ._models_py3 import AzureMachineLearningWebServiceInputColumn @@ -51,6 +53,7 @@ from ._models_py3 import EventHubStreamInputDataSourceProperties from ._models_py3 import EventHubV2OutputDataSource from ._models_py3 import EventHubV2StreamInputDataSource +from ._models_py3 import FileReferenceInputDataSource from ._models_py3 import Function from ._models_py3 import FunctionBinding from ._models_py3 import FunctionInput @@ -58,6 +61,11 @@ from ._models_py3 import FunctionOutput from ._models_py3 import FunctionProperties from ._models_py3 import FunctionRetrieveDefaultDefinitionParameters +from ._models_py3 import GatewayMessageBusOutputDataSource +from ._models_py3 import GatewayMessageBusOutputDataSourceProperties +from ._models_py3 import GatewayMessageBusSourceProperties +from ._models_py3 import GatewayMessageBusStreamInputDataSource +from ._models_py3 import GatewayMessageBusStreamInputDataSourceProperties from ._models_py3 import Identity from ._models_py3 import Input from ._models_py3 import InputListResult @@ -126,11 +134,15 @@ RefreshType, SkuName, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ + 'AggregateFunctionProperties', 'AvroSerialization', 'AzureDataLakeStoreOutputDataSource', 'AzureDataLakeStoreOutputDataSourceProperties', + 'AzureFunctionOutputDataSource', 'AzureMachineLearningWebServiceFunctionBinding', 'AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters', 'AzureMachineLearningWebServiceInputColumn', @@ -173,6 +185,7 @@ 'EventHubStreamInputDataSourceProperties', 'EventHubV2OutputDataSource', 'EventHubV2StreamInputDataSource', + 'FileReferenceInputDataSource', 'Function', 'FunctionBinding', 'FunctionInput', @@ -180,6 +193,11 @@ 'FunctionOutput', 'FunctionProperties', 'FunctionRetrieveDefaultDefinitionParameters', + 'GatewayMessageBusOutputDataSource', + 'GatewayMessageBusOutputDataSourceProperties', + 'GatewayMessageBusSourceProperties', + 'GatewayMessageBusStreamInputDataSource', + 'GatewayMessageBusStreamInputDataSourceProperties', 'Identity', 'Input', 'InputListResult', @@ -245,3 +263,5 @@ 'RefreshType', 'SkuName', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_models_py3.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_models_py3.py index 49628eb32af4..ffc8d3779038 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_models_py3.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_models_py3.py @@ -7,12 +7,137 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._stream_analytics_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models + + +class FunctionProperties(msrest.serialization.Model): + """The properties that are associated with a function. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AggregateFunctionProperties, ScalarFunctionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Indicates the type of function.Constant filled by server. + :vartype type: str + :ivar etag: The current entity tag for the function. This is an opaque string. You can use it + to detect whether the resource has changed between requests. You can also use it in the + If-Match or If-None-Match headers for write operations for optimistic concurrency. + :vartype etag: str + :ivar inputs: + :vartype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :ivar output: Describes the output of a function. + :vartype output: ~azure.mgmt.streamanalytics.models.FunctionOutput + :ivar binding: The physical binding of the function. For example, in the Azure Machine Learning + web service’s case, this describes the endpoint. + :vartype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding + """ + + _validation = { + 'type': {'required': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'inputs': {'key': 'properties.inputs', 'type': '[FunctionInput]'}, + 'output': {'key': 'properties.output', 'type': 'FunctionOutput'}, + 'binding': {'key': 'properties.binding', 'type': 'FunctionBinding'}, + } + + _subtype_map = { + 'type': {'Aggregate': 'AggregateFunctionProperties', 'Scalar': 'ScalarFunctionProperties'} + } + + def __init__( + self, + *, + inputs: Optional[List["_models.FunctionInput"]] = None, + output: Optional["_models.FunctionOutput"] = None, + binding: Optional["_models.FunctionBinding"] = None, + **kwargs + ): + """ + :keyword inputs: + :paramtype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :keyword output: Describes the output of a function. + :paramtype output: ~azure.mgmt.streamanalytics.models.FunctionOutput + :keyword binding: The physical binding of the function. For example, in the Azure Machine + Learning web service’s case, this describes the endpoint. + :paramtype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding + """ + super(FunctionProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.etag = None + self.inputs = inputs + self.output = output + self.binding = binding + + +class AggregateFunctionProperties(FunctionProperties): + """The properties that are associated with an aggregate function. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Indicates the type of function.Constant filled by server. + :vartype type: str + :ivar etag: The current entity tag for the function. This is an opaque string. You can use it + to detect whether the resource has changed between requests. You can also use it in the + If-Match or If-None-Match headers for write operations for optimistic concurrency. + :vartype etag: str + :ivar inputs: + :vartype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :ivar output: Describes the output of a function. + :vartype output: ~azure.mgmt.streamanalytics.models.FunctionOutput + :ivar binding: The physical binding of the function. For example, in the Azure Machine Learning + web service’s case, this describes the endpoint. + :vartype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding + """ + + _validation = { + 'type': {'required': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'inputs': {'key': 'properties.inputs', 'type': '[FunctionInput]'}, + 'output': {'key': 'properties.output', 'type': 'FunctionOutput'}, + 'binding': {'key': 'properties.binding', 'type': 'FunctionBinding'}, + } + + def __init__( + self, + *, + inputs: Optional[List["_models.FunctionInput"]] = None, + output: Optional["_models.FunctionOutput"] = None, + binding: Optional["_models.FunctionBinding"] = None, + **kwargs + ): + """ + :keyword inputs: + :paramtype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :keyword output: Describes the output of a function. + :paramtype output: ~azure.mgmt.streamanalytics.models.FunctionOutput + :keyword binding: The physical binding of the function. For example, in the Azure Machine + Learning web service’s case, this describes the endpoint. + :paramtype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding + """ + super(AggregateFunctionProperties, self).__init__(inputs=inputs, output=output, binding=binding, **kwargs) + self.type = 'Aggregate' # type: str class Serialization(msrest.serialization.Model): @@ -24,9 +149,9 @@ class Serialization(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of serialization that the input or output uses. - Required on PUT (CreateOrReplace) requests.Constant filled by server. Possible values include: - "Csv", "Avro", "Json", "Parquet". - :vartype type: str or ~stream_analytics_management_client.models.EventSerializationType + Required on PUT (CreateOrReplace) requests.Constant filled by server. Known values are: "Csv", + "Avro", "Json", "Parquet". + :vartype type: str or ~azure.mgmt.streamanalytics.models.EventSerializationType """ _validation = { @@ -57,9 +182,9 @@ class AvroSerialization(Serialization): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of serialization that the input or output uses. - Required on PUT (CreateOrReplace) requests.Constant filled by server. Possible values include: - "Csv", "Avro", "Json", "Parquet". - :vartype type: str or ~stream_analytics_management_client.models.EventSerializationType + Required on PUT (CreateOrReplace) requests.Constant filled by server. Known values are: "Csv", + "Avro", "Json", "Parquet". + :vartype type: str or ~azure.mgmt.streamanalytics.models.EventSerializationType :ivar properties: The properties that are associated with the Avro serialization type. Required on PUT (CreateOrReplace) requests. :vartype properties: any @@ -94,7 +219,7 @@ class OutputDataSource(msrest.serialization.Model): """Describes the data source that output will be written to. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureDataLakeStoreOutputDataSource, EventHubV2OutputDataSource, EventHubOutputDataSource, ServiceBusQueueOutputDataSource, ServiceBusTopicOutputDataSource, AzureSynapseOutputDataSource, AzureSqlDatabaseOutputDataSource, BlobOutputDataSource, DocumentDbOutputDataSource, AzureTableOutputDataSource, PowerBIOutputDataSource. + sub-classes are: GatewayMessageBusOutputDataSource, AzureFunctionOutputDataSource, AzureDataLakeStoreOutputDataSource, EventHubV2OutputDataSource, EventHubOutputDataSource, ServiceBusQueueOutputDataSource, ServiceBusTopicOutputDataSource, AzureSynapseOutputDataSource, AzureSqlDatabaseOutputDataSource, BlobOutputDataSource, DocumentDbOutputDataSource, AzureTableOutputDataSource, PowerBIOutputDataSource. All required parameters must be populated in order to send to Azure. @@ -112,7 +237,7 @@ class OutputDataSource(msrest.serialization.Model): } _subtype_map = { - 'type': {'Microsoft.DataLake/Accounts': 'AzureDataLakeStoreOutputDataSource', 'Microsoft.EventHub/EventHub': 'EventHubV2OutputDataSource', 'Microsoft.ServiceBus/EventHub': 'EventHubOutputDataSource', 'Microsoft.ServiceBus/Queue': 'ServiceBusQueueOutputDataSource', 'Microsoft.ServiceBus/Topic': 'ServiceBusTopicOutputDataSource', 'Microsoft.Sql/Server/DataWarehouse': 'AzureSynapseOutputDataSource', 'Microsoft.Sql/Server/Database': 'AzureSqlDatabaseOutputDataSource', 'Microsoft.Storage/Blob': 'BlobOutputDataSource', 'Microsoft.Storage/DocumentDB': 'DocumentDbOutputDataSource', 'Microsoft.Storage/Table': 'AzureTableOutputDataSource', 'PowerBI': 'PowerBIOutputDataSource'} + 'type': {'GatewayMessageBus': 'GatewayMessageBusOutputDataSource', 'Microsoft.AzureFunction': 'AzureFunctionOutputDataSource', 'Microsoft.DataLake/Accounts': 'AzureDataLakeStoreOutputDataSource', 'Microsoft.EventHub/EventHub': 'EventHubV2OutputDataSource', 'Microsoft.ServiceBus/EventHub': 'EventHubOutputDataSource', 'Microsoft.ServiceBus/Queue': 'ServiceBusQueueOutputDataSource', 'Microsoft.ServiceBus/Topic': 'ServiceBusTopicOutputDataSource', 'Microsoft.Sql/Server/DataWarehouse': 'AzureSynapseOutputDataSource', 'Microsoft.Sql/Server/Database': 'AzureSqlDatabaseOutputDataSource', 'Microsoft.Storage/Blob': 'BlobOutputDataSource', 'Microsoft.Storage/DocumentDB': 'DocumentDbOutputDataSource', 'Microsoft.Storage/Table': 'AzureTableOutputDataSource', 'PowerBI': 'PowerBIOutputDataSource'} } def __init__( @@ -163,10 +288,9 @@ class AzureDataLakeStoreOutputDataSource(OutputDataSource): :ivar time_format: The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. :vartype time_format: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _validation = { @@ -197,7 +321,7 @@ def __init__( file_path_prefix: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -231,10 +355,9 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. :paramtype time_format: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(AzureDataLakeStoreOutputDataSource, self).__init__(**kwargs) self.type = 'Microsoft.DataLake/Accounts' # type: str @@ -339,10 +462,9 @@ class AzureDataLakeStoreOutputDataSourceProperties(OAuthBasedDataSourcePropertie :ivar time_format: The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. :vartype time_format: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -368,7 +490,7 @@ def __init__( file_path_prefix: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -402,10 +524,9 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. :paramtype time_format: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(AzureDataLakeStoreOutputDataSourceProperties, self).__init__(refresh_token=refresh_token, token_user_principal_name=token_user_principal_name, token_user_display_name=token_user_display_name, **kwargs) self.account_name = account_name @@ -416,6 +537,78 @@ def __init__( self.authentication_mode = authentication_mode +class AzureFunctionOutputDataSource(OutputDataSource): + """Defines the metadata of AzureFunctionOutputDataSource. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Indicates the type of data source output will be written to. Required on + PUT (CreateOrReplace) requests.Constant filled by server. + :vartype type: str + :ivar function_app_name: The name of your Azure Functions app. + :vartype function_app_name: str + :ivar function_name: The name of the function in your Azure Functions app. + :vartype function_name: str + :ivar api_key: If you want to use an Azure Function from another subscription, you can do so by + providing the key to access your function. + :vartype api_key: str + :ivar max_batch_size: A property that lets you set the maximum size for each output batch + that's sent to your Azure function. The input unit is in bytes. By default, this value is + 262,144 bytes (256 KB). + :vartype max_batch_size: float + :ivar max_batch_count: A property that lets you specify the maximum number of events in each + batch that's sent to Azure Functions. The default value is 100. + :vartype max_batch_count: float + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'function_app_name': {'key': 'properties.functionAppName', 'type': 'str'}, + 'function_name': {'key': 'properties.functionName', 'type': 'str'}, + 'api_key': {'key': 'properties.apiKey', 'type': 'str'}, + 'max_batch_size': {'key': 'properties.maxBatchSize', 'type': 'float'}, + 'max_batch_count': {'key': 'properties.maxBatchCount', 'type': 'float'}, + } + + def __init__( + self, + *, + function_app_name: Optional[str] = None, + function_name: Optional[str] = None, + api_key: Optional[str] = None, + max_batch_size: Optional[float] = None, + max_batch_count: Optional[float] = None, + **kwargs + ): + """ + :keyword function_app_name: The name of your Azure Functions app. + :paramtype function_app_name: str + :keyword function_name: The name of the function in your Azure Functions app. + :paramtype function_name: str + :keyword api_key: If you want to use an Azure Function from another subscription, you can do so + by providing the key to access your function. + :paramtype api_key: str + :keyword max_batch_size: A property that lets you set the maximum size for each output batch + that's sent to your Azure function. The input unit is in bytes. By default, this value is + 262,144 bytes (256 KB). + :paramtype max_batch_size: float + :keyword max_batch_count: A property that lets you specify the maximum number of events in each + batch that's sent to Azure Functions. The default value is 100. + :paramtype max_batch_count: float + """ + super(AzureFunctionOutputDataSource, self).__init__(**kwargs) + self.type = 'Microsoft.AzureFunction' # type: str + self.function_app_name = function_app_name + self.function_name = function_name + self.api_key = api_key + self.max_batch_size = max_batch_size + self.max_batch_count = max_batch_count + + class FunctionBinding(msrest.serialization.Model): """The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. @@ -464,12 +657,11 @@ class AzureMachineLearningWebServiceFunctionBinding(FunctionBinding): :ivar api_key: The API key used to authenticate with Request-Response endpoint. :vartype api_key: str :ivar inputs: The inputs for the Azure Machine Learning web service endpoint. - :vartype inputs: - ~stream_analytics_management_client.models.AzureMachineLearningWebServiceInputs + :vartype inputs: ~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceInputs :ivar outputs: A list of outputs from the Azure Machine Learning web service endpoint execution. :vartype outputs: - list[~stream_analytics_management_client.models.AzureMachineLearningWebServiceOutputColumn] + list[~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceOutputColumn] :ivar batch_size: Number between 1 and 10000 describing maximum number of rows for every Azure ML RRS execute request. Default is 1000. :vartype batch_size: int @@ -493,8 +685,8 @@ def __init__( *, endpoint: Optional[str] = None, api_key: Optional[str] = None, - inputs: Optional["AzureMachineLearningWebServiceInputs"] = None, - outputs: Optional[List["AzureMachineLearningWebServiceOutputColumn"]] = None, + inputs: Optional["_models.AzureMachineLearningWebServiceInputs"] = None, + outputs: Optional[List["_models.AzureMachineLearningWebServiceOutputColumn"]] = None, batch_size: Optional[int] = None, **kwargs ): @@ -506,12 +698,11 @@ def __init__( :keyword api_key: The API key used to authenticate with Request-Response endpoint. :paramtype api_key: str :keyword inputs: The inputs for the Azure Machine Learning web service endpoint. - :paramtype inputs: - ~stream_analytics_management_client.models.AzureMachineLearningWebServiceInputs + :paramtype inputs: ~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceInputs :keyword outputs: A list of outputs from the Azure Machine Learning web service endpoint execution. :paramtype outputs: - list[~stream_analytics_management_client.models.AzureMachineLearningWebServiceOutputColumn] + list[~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceOutputColumn] :keyword batch_size: Number between 1 and 10000 describing maximum number of rows for every Azure ML RRS execute request. Default is 1000. :paramtype batch_size: int @@ -658,7 +849,7 @@ class AzureMachineLearningWebServiceInputs(msrest.serialization.Model): :ivar column_names: A list of input columns for the Azure Machine Learning web service endpoint. :vartype column_names: - list[~stream_analytics_management_client.models.AzureMachineLearningWebServiceInputColumn] + list[~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceInputColumn] """ _attribute_map = { @@ -670,7 +861,7 @@ def __init__( self, *, name: Optional[str] = None, - column_names: Optional[List["AzureMachineLearningWebServiceInputColumn"]] = None, + column_names: Optional[List["_models.AzureMachineLearningWebServiceInputColumn"]] = None, **kwargs ): """ @@ -679,7 +870,7 @@ def __init__( :keyword column_names: A list of input columns for the Azure Machine Learning web service endpoint. :paramtype column_names: - list[~stream_analytics_management_client.models.AzureMachineLearningWebServiceInputColumn] + list[~azure.mgmt.streamanalytics.models.AzureMachineLearningWebServiceInputColumn] """ super(AzureMachineLearningWebServiceInputs, self).__init__(**kwargs) self.name = name @@ -745,10 +936,9 @@ class AzureSqlDatabaseDataSourceProperties(msrest.serialization.Model): :ivar max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :vartype max_writer_count: float - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -772,7 +962,7 @@ def __init__( table: Optional[str] = None, max_batch_count: Optional[float] = None, max_writer_count: Optional[float] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -797,10 +987,9 @@ def __init__( :keyword max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :paramtype max_writer_count: float - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(AzureSqlDatabaseDataSourceProperties, self).__init__(**kwargs) self.server = server @@ -841,10 +1030,9 @@ class AzureSqlDatabaseOutputDataSource(OutputDataSource): :ivar max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :vartype max_writer_count: float - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _validation = { @@ -873,7 +1061,7 @@ def __init__( table: Optional[str] = None, max_batch_count: Optional[float] = None, max_writer_count: Optional[float] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -898,10 +1086,9 @@ def __init__( :keyword max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :paramtype max_writer_count: float - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(AzureSqlDatabaseOutputDataSource, self).__init__(**kwargs) self.type = 'Microsoft.Sql/Server/Database' # type: str @@ -938,10 +1125,9 @@ class AzureSqlDatabaseOutputDataSourceProperties(AzureSqlDatabaseDataSourcePrope :ivar max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :vartype max_writer_count: float - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -965,7 +1151,7 @@ def __init__( table: Optional[str] = None, max_batch_count: Optional[float] = None, max_writer_count: Optional[float] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -990,10 +1176,9 @@ def __init__( :keyword max_writer_count: Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. :paramtype max_writer_count: float - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(AzureSqlDatabaseOutputDataSourceProperties, self).__init__(server=server, database=database, user=user, password=password, table=table, max_batch_count=max_batch_count, max_writer_count=max_writer_count, authentication_mode=authentication_mode, **kwargs) @@ -1002,7 +1187,7 @@ class ReferenceInputDataSource(msrest.serialization.Model): """Describes an input data source that contains reference data. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureSqlReferenceInputDataSource, BlobReferenceInputDataSource. + sub-classes are: FileReferenceInputDataSource, AzureSqlReferenceInputDataSource, BlobReferenceInputDataSource. All required parameters must be populated in order to send to Azure. @@ -1020,7 +1205,7 @@ class ReferenceInputDataSource(msrest.serialization.Model): } _subtype_map = { - 'type': {'Microsoft.Sql/Server/Database': 'AzureSqlReferenceInputDataSource', 'Microsoft.Storage/Blob': 'BlobReferenceInputDataSource'} + 'type': {'File': 'FileReferenceInputDataSource', 'Microsoft.Sql/Server/Database': 'AzureSqlReferenceInputDataSource', 'Microsoft.Storage/Blob': 'BlobReferenceInputDataSource'} } def __init__( @@ -1056,9 +1241,9 @@ class AzureSqlReferenceInputDataSource(ReferenceInputDataSource): :ivar table: This element is associated with the datasource element. The name of the table in the Azure SQL database.. :vartype table: str - :ivar refresh_type: Indicates the type of data refresh option. Possible values include: - "Static", "RefreshPeriodicallyWithFull", "RefreshPeriodicallyWithDelta". - :vartype refresh_type: str or ~stream_analytics_management_client.models.RefreshType + :ivar refresh_type: Indicates the type of data refresh option. Known values are: "Static", + "RefreshPeriodicallyWithFull", "RefreshPeriodicallyWithDelta". + :vartype refresh_type: str or ~azure.mgmt.streamanalytics.models.RefreshType :ivar refresh_rate: This element is associated with the datasource element. This indicates how frequently the data will be fetched from the database. It is of DateTime format. :vartype refresh_rate: str @@ -1096,7 +1281,7 @@ def __init__( user: Optional[str] = None, password: Optional[str] = None, table: Optional[str] = None, - refresh_type: Optional[Union[str, "RefreshType"]] = None, + refresh_type: Optional[Union[str, "_models.RefreshType"]] = None, refresh_rate: Optional[str] = None, full_snapshot_query: Optional[str] = None, delta_snapshot_query: Optional[str] = None, @@ -1118,9 +1303,9 @@ def __init__( :keyword table: This element is associated with the datasource element. The name of the table in the Azure SQL database.. :paramtype table: str - :keyword refresh_type: Indicates the type of data refresh option. Possible values include: - "Static", "RefreshPeriodicallyWithFull", "RefreshPeriodicallyWithDelta". - :paramtype refresh_type: str or ~stream_analytics_management_client.models.RefreshType + :keyword refresh_type: Indicates the type of data refresh option. Known values are: "Static", + "RefreshPeriodicallyWithFull", "RefreshPeriodicallyWithDelta". + :paramtype refresh_type: str or ~azure.mgmt.streamanalytics.models.RefreshType :keyword refresh_rate: This element is associated with the datasource element. This indicates how frequently the data will be fetched from the database. It is of DateTime format. :paramtype refresh_rate: str @@ -1434,7 +1619,7 @@ class BlobDataSourceProperties(msrest.serialization.Model): :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1452,6 +1637,9 @@ class BlobDataSourceProperties(msrest.serialization.Model): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -1460,22 +1648,24 @@ class BlobDataSourceProperties(msrest.serialization.Model): 'path_pattern': {'key': 'pathPattern', 'type': 'str'}, 'date_format': {'key': 'dateFormat', 'type': 'str'}, 'time_format': {'key': 'timeFormat', 'type': 'str'}, + 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1493,6 +1683,9 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(BlobDataSourceProperties, self).__init__(**kwargs) self.storage_accounts = storage_accounts @@ -1500,6 +1693,7 @@ def __init__( self.path_pattern = path_pattern self.date_format = date_format self.time_format = time_format + self.authentication_mode = authentication_mode class BlobOutputDataSource(OutputDataSource): @@ -1512,7 +1706,7 @@ class BlobOutputDataSource(OutputDataSource): :vartype type: str :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1530,10 +1724,11 @@ class BlobOutputDataSource(OutputDataSource): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :ivar blob_path_prefix: Blob path prefix. + :vartype blob_path_prefix: str """ _validation = { @@ -1548,23 +1743,25 @@ class BlobOutputDataSource(OutputDataSource): 'date_format': {'key': 'properties.dateFormat', 'type': 'str'}, 'time_format': {'key': 'properties.timeFormat', 'type': 'str'}, 'authentication_mode': {'key': 'properties.authenticationMode', 'type': 'str'}, + 'blob_path_prefix': {'key': 'properties.blobPathPrefix', 'type': 'str'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", + blob_path_prefix: Optional[str] = None, **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1582,10 +1779,11 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :keyword blob_path_prefix: Blob path prefix. + :paramtype blob_path_prefix: str """ super(BlobOutputDataSource, self).__init__(**kwargs) self.type = 'Microsoft.Storage/Blob' # type: str @@ -1595,6 +1793,7 @@ def __init__( self.date_format = date_format self.time_format = time_format self.authentication_mode = authentication_mode + self.blob_path_prefix = blob_path_prefix class BlobOutputDataSourceProperties(BlobDataSourceProperties): @@ -1602,7 +1801,7 @@ class BlobOutputDataSourceProperties(BlobDataSourceProperties): :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1620,10 +1819,11 @@ class BlobOutputDataSourceProperties(BlobDataSourceProperties): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :ivar blob_path_prefix: Blob path prefix. + :vartype blob_path_prefix: str """ _attribute_map = { @@ -1633,23 +1833,25 @@ class BlobOutputDataSourceProperties(BlobDataSourceProperties): 'date_format': {'key': 'dateFormat', 'type': 'str'}, 'time_format': {'key': 'timeFormat', 'type': 'str'}, 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, + 'blob_path_prefix': {'key': 'blobPathPrefix', 'type': 'str'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", + blob_path_prefix: Optional[str] = None, **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1667,13 +1869,14 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :keyword blob_path_prefix: Blob path prefix. + :paramtype blob_path_prefix: str """ - super(BlobOutputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, **kwargs) - self.authentication_mode = authentication_mode + super(BlobOutputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, authentication_mode=authentication_mode, **kwargs) + self.blob_path_prefix = blob_path_prefix class BlobReferenceInputDataSource(ReferenceInputDataSource): @@ -1686,7 +1889,7 @@ class BlobReferenceInputDataSource(ReferenceInputDataSource): :vartype type: str :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1704,6 +1907,9 @@ class BlobReferenceInputDataSource(ReferenceInputDataSource): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _validation = { @@ -1717,22 +1923,24 @@ class BlobReferenceInputDataSource(ReferenceInputDataSource): 'path_pattern': {'key': 'properties.pathPattern', 'type': 'str'}, 'date_format': {'key': 'properties.dateFormat', 'type': 'str'}, 'time_format': {'key': 'properties.timeFormat', 'type': 'str'}, + 'authentication_mode': {'key': 'properties.authenticationMode', 'type': 'str'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1750,6 +1958,9 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(BlobReferenceInputDataSource, self).__init__(**kwargs) self.type = 'Microsoft.Storage/Blob' # type: str @@ -1758,6 +1969,7 @@ def __init__( self.path_pattern = path_pattern self.date_format = date_format self.time_format = time_format + self.authentication_mode = authentication_mode class BlobReferenceInputDataSourceProperties(BlobDataSourceProperties): @@ -1765,7 +1977,7 @@ class BlobReferenceInputDataSourceProperties(BlobDataSourceProperties): :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1783,6 +1995,9 @@ class BlobReferenceInputDataSourceProperties(BlobDataSourceProperties): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -1791,22 +2006,24 @@ class BlobReferenceInputDataSourceProperties(BlobDataSourceProperties): 'path_pattern': {'key': 'pathPattern', 'type': 'str'}, 'date_format': {'key': 'dateFormat', 'type': 'str'}, 'time_format': {'key': 'timeFormat', 'type': 'str'}, + 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1824,15 +2041,18 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ - super(BlobReferenceInputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, **kwargs) + super(BlobReferenceInputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, authentication_mode=authentication_mode, **kwargs) class StreamInputDataSource(msrest.serialization.Model): """Describes an input data source that contains stream data. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IoTHubStreamInputDataSource, EventHubV2StreamInputDataSource, EventHubStreamInputDataSource, BlobStreamInputDataSource. + sub-classes are: GatewayMessageBusStreamInputDataSource, IoTHubStreamInputDataSource, EventHubV2StreamInputDataSource, EventHubStreamInputDataSource, BlobStreamInputDataSource. All required parameters must be populated in order to send to Azure. @@ -1850,7 +2070,7 @@ class StreamInputDataSource(msrest.serialization.Model): } _subtype_map = { - 'type': {'Microsoft.Devices/IotHubs': 'IoTHubStreamInputDataSource', 'Microsoft.EventHub/EventHub': 'EventHubV2StreamInputDataSource', 'Microsoft.ServiceBus/EventHub': 'EventHubStreamInputDataSource', 'Microsoft.Storage/Blob': 'BlobStreamInputDataSource'} + 'type': {'GatewayMessageBus': 'GatewayMessageBusStreamInputDataSource', 'Microsoft.Devices/IotHubs': 'IoTHubStreamInputDataSource', 'Microsoft.EventHub/EventHub': 'EventHubV2StreamInputDataSource', 'Microsoft.ServiceBus/EventHub': 'EventHubStreamInputDataSource', 'Microsoft.Storage/Blob': 'BlobStreamInputDataSource'} } def __init__( @@ -1873,7 +2093,7 @@ class BlobStreamInputDataSource(StreamInputDataSource): :vartype type: str :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1891,7 +2111,11 @@ class BlobStreamInputDataSource(StreamInputDataSource): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str - :ivar source_partition_count: The partition count of the blob input data source. Range 1 - 256. + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :ivar source_partition_count: The partition count of the blob input data source. Range 1 - + 1024. :vartype source_partition_count: int """ @@ -1906,24 +2130,26 @@ class BlobStreamInputDataSource(StreamInputDataSource): 'path_pattern': {'key': 'properties.pathPattern', 'type': 'str'}, 'date_format': {'key': 'properties.dateFormat', 'type': 'str'}, 'time_format': {'key': 'properties.timeFormat', 'type': 'str'}, + 'authentication_mode': {'key': 'properties.authenticationMode', 'type': 'str'}, 'source_partition_count': {'key': 'properties.sourcePartitionCount', 'type': 'int'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", source_partition_count: Optional[int] = None, **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1941,8 +2167,11 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword source_partition_count: The partition count of the blob input data source. Range 1 - - 256. + 1024. :paramtype source_partition_count: int """ super(BlobStreamInputDataSource, self).__init__(**kwargs) @@ -1952,6 +2181,7 @@ def __init__( self.path_pattern = path_pattern self.date_format = date_format self.time_format = time_format + self.authentication_mode = authentication_mode self.source_partition_count = source_partition_count @@ -1960,7 +2190,7 @@ class BlobStreamInputDataSourceProperties(BlobDataSourceProperties): :ivar storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :vartype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :vartype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :ivar container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1978,7 +2208,11 @@ class BlobStreamInputDataSourceProperties(BlobDataSourceProperties): :ivar time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :vartype time_format: str - :ivar source_partition_count: The partition count of the blob input data source. Range 1 - 256. + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode + :ivar source_partition_count: The partition count of the blob input data source. Range 1 - + 1024. :vartype source_partition_count: int """ @@ -1988,24 +2222,26 @@ class BlobStreamInputDataSourceProperties(BlobDataSourceProperties): 'path_pattern': {'key': 'pathPattern', 'type': 'str'}, 'date_format': {'key': 'dateFormat', 'type': 'str'}, 'time_format': {'key': 'timeFormat', 'type': 'str'}, + 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, 'source_partition_count': {'key': 'sourcePartitionCount', 'type': 'int'}, } def __init__( self, *, - storage_accounts: Optional[List["StorageAccount"]] = None, + storage_accounts: Optional[List["_models.StorageAccount"]] = None, container: Optional[str] = None, path_pattern: Optional[str] = None, date_format: Optional[str] = None, time_format: Optional[str] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", source_partition_count: Optional[int] = None, **kwargs ): """ :keyword storage_accounts: A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. - :paramtype storage_accounts: list[~stream_analytics_management_client.models.StorageAccount] + :paramtype storage_accounts: list[~azure.mgmt.streamanalytics.models.StorageAccount] :keyword container: The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -2023,11 +2259,14 @@ def __init__( :keyword time_format: The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. :paramtype time_format: str + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword source_partition_count: The partition count of the blob input data source. Range 1 - - 256. + 1024. :paramtype source_partition_count: int """ - super(BlobStreamInputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, **kwargs) + super(BlobStreamInputDataSourceProperties, self).__init__(storage_accounts=storage_accounts, container=container, path_pattern=path_pattern, date_format=date_format, time_format=time_format, authentication_mode=authentication_mode, **kwargs) self.source_partition_count = source_partition_count @@ -2140,7 +2379,7 @@ class Cluster(TrackedResource): :vartype location: str :ivar sku: The SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT (CreateOrUpdate) requests. - :vartype sku: ~stream_analytics_management_client.models.ClusterSku + :vartype sku: ~azure.mgmt.streamanalytics.models.ClusterSku :ivar etag: The current entity tag for the cluster. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. @@ -2150,10 +2389,9 @@ class Cluster(TrackedResource): :ivar cluster_id: Unique identifier for the cluster. :vartype cluster_id: str :ivar provisioning_state: The status of the cluster provisioning. The three terminal states - are: Succeeded, Failed and Canceled. Possible values include: "Succeeded", "Failed", - "Canceled", "InProgress". - :vartype provisioning_state: str or - ~stream_analytics_management_client.models.ClusterProvisioningState + are: Succeeded, Failed and Canceled. Known values are: "Succeeded", "Failed", "Canceled", + "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.streamanalytics.models.ClusterProvisioningState :ivar capacity_allocated: Represents the number of streaming units currently being used on the cluster. :vartype capacity_allocated: int @@ -2194,7 +2432,7 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, - sku: Optional["ClusterSku"] = None, + sku: Optional["_models.ClusterSku"] = None, **kwargs ): """ @@ -2204,7 +2442,7 @@ def __init__( :paramtype location: str :keyword sku: The SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT (CreateOrUpdate) requests. - :paramtype sku: ~stream_analytics_management_client.models.ClusterSku + :paramtype sku: ~azure.mgmt.streamanalytics.models.ClusterSku """ super(Cluster, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku @@ -2250,10 +2488,10 @@ class ClusterJob(msrest.serialization.Model): :vartype id: str :ivar streaming_units: The number of streaming units that are used by the streaming job. :vartype streaming_units: int - :ivar job_state: The current execution state of the streaming job. Possible values include: - "Created", "Starting", "Running", "Stopping", "Stopped", "Deleting", "Failed", "Degraded", - "Restarting", "Scaling". - :vartype job_state: str or ~stream_analytics_management_client.models.JobState + :ivar job_state: The current execution state of the streaming job. Known values are: "Created", + "Starting", "Running", "Stopping", "Stopped", "Deleting", "Failed", "Degraded", "Restarting", + "Scaling". + :vartype job_state: str or ~azure.mgmt.streamanalytics.models.JobState """ _validation = { @@ -2286,7 +2524,7 @@ class ClusterJobListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of streaming jobs. - :vartype value: list[~stream_analytics_management_client.models.ClusterJob] + :vartype value: list[~azure.mgmt.streamanalytics.models.ClusterJob] :ivar next_link: The URL to fetch the next set of streaming jobs. :vartype next_link: str """ @@ -2318,7 +2556,7 @@ class ClusterListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of clusters. - :vartype value: list[~stream_analytics_management_client.models.Cluster] + :vartype value: list[~azure.mgmt.streamanalytics.models.Cluster] :ivar next_link: The URL to fetch the next set of clusters. :vartype next_link: str """ @@ -2348,8 +2586,8 @@ class ClusterSku(msrest.serialization.Model): """The SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT (CreateOrUpdate) requests. :ivar name: Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) requests. - Possible values include: "Default". - :vartype name: str or ~stream_analytics_management_client.models.ClusterSkuName + Known values are: "Default". + :vartype name: str or ~azure.mgmt.streamanalytics.models.ClusterSkuName :ivar capacity: Denotes the number of streaming units the cluster can support. Valid values for this property are multiples of 36 with a minimum value of 36 and maximum value of 216. Required on PUT (CreateOrUpdate) requests. @@ -2357,7 +2595,7 @@ class ClusterSku(msrest.serialization.Model): """ _validation = { - 'capacity': {'maximum': 216, 'minimum': 36}, + 'capacity': {'maximum': 396, 'minimum': 36}, } _attribute_map = { @@ -2368,14 +2606,14 @@ class ClusterSku(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ClusterSkuName"]] = None, + name: Optional[Union[str, "_models.ClusterSkuName"]] = None, capacity: Optional[int] = None, **kwargs ): """ :keyword name: Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) - requests. Possible values include: "Default". - :paramtype name: str or ~stream_analytics_management_client.models.ClusterSkuName + requests. Known values are: "Default". + :paramtype name: str or ~azure.mgmt.streamanalytics.models.ClusterSkuName :keyword capacity: Denotes the number of streaming units the cluster can support. Valid values for this property are multiples of 36 with a minimum value of 36 and maximum value of 216. Required on PUT (CreateOrUpdate) requests. @@ -2392,8 +2630,8 @@ class Compression(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of compression that the input uses. Required on PUT - (CreateOrReplace) requests. Possible values include: "None", "GZip", "Deflate". - :vartype type: str or ~stream_analytics_management_client.models.CompressionType + (CreateOrReplace) requests. Known values are: "None", "GZip", "Deflate". Default value: "None". + :vartype type: str or ~azure.mgmt.streamanalytics.models.CompressionType """ _validation = { @@ -2407,13 +2645,13 @@ class Compression(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "CompressionType"], + type: Union[str, "_models.CompressionType"] = "None", **kwargs ): """ :keyword type: Required. Indicates the type of compression that the input uses. Required on PUT - (CreateOrReplace) requests. Possible values include: "None", "GZip", "Deflate". - :paramtype type: str or ~stream_analytics_management_client.models.CompressionType + (CreateOrReplace) requests. Known values are: "None", "GZip", "Deflate". Default value: "None". + :paramtype type: str or ~azure.mgmt.streamanalytics.models.CompressionType """ super(Compression, self).__init__(**kwargs) self.type = type @@ -2425,9 +2663,9 @@ class CsvSerialization(Serialization): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of serialization that the input or output uses. - Required on PUT (CreateOrReplace) requests.Constant filled by server. Possible values include: - "Csv", "Avro", "Json", "Parquet". - :vartype type: str or ~stream_analytics_management_client.models.EventSerializationType + Required on PUT (CreateOrReplace) requests.Constant filled by server. Known values are: "Csv", + "Avro", "Json", "Parquet". + :vartype type: str or ~azure.mgmt.streamanalytics.models.EventSerializationType :ivar field_delimiter: Specifies the delimiter that will be used to separate comma-separated value (CSV) records. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or @@ -2436,8 +2674,8 @@ class CsvSerialization(Serialization): :vartype field_delimiter: str :ivar encoding: Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. - Possible values include: "UTF8". - :vartype encoding: str or ~stream_analytics_management_client.models.Encoding + Known values are: "UTF8". + :vartype encoding: str or ~azure.mgmt.streamanalytics.models.Encoding """ _validation = { @@ -2454,7 +2692,7 @@ def __init__( self, *, field_delimiter: Optional[str] = None, - encoding: Optional[Union[str, "Encoding"]] = None, + encoding: Optional[Union[str, "_models.Encoding"]] = None, **kwargs ): """ @@ -2466,8 +2704,8 @@ def __init__( :paramtype field_delimiter: str :keyword encoding: Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. - Possible values include: "UTF8". - :paramtype encoding: str or ~stream_analytics_management_client.models.Encoding + Known values are: "UTF8". + :paramtype encoding: str or ~azure.mgmt.streamanalytics.models.Encoding """ super(CsvSerialization, self).__init__(**kwargs) self.type = 'Csv' # type: str @@ -2521,7 +2759,7 @@ class Diagnostics(msrest.serialization.Model): :ivar conditions: A collection of zero or more conditions applicable to the resource, or to the job overall, that warrant customer attention. - :vartype conditions: list[~stream_analytics_management_client.models.DiagnosticCondition] + :vartype conditions: list[~azure.mgmt.streamanalytics.models.DiagnosticCondition] """ _validation = { @@ -2637,7 +2875,7 @@ class Error(msrest.serialization.Model): """Common error representation. :ivar error: Error definition properties. - :vartype error: ~stream_analytics_management_client.models.ErrorError + :vartype error: ~azure.mgmt.streamanalytics.models.ErrorError """ _attribute_map = { @@ -2647,12 +2885,12 @@ class Error(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorError"] = None, + error: Optional["_models.ErrorError"] = None, **kwargs ): """ :keyword error: Error definition properties. - :paramtype error: ~stream_analytics_management_client.models.ErrorError + :paramtype error: ~azure.mgmt.streamanalytics.models.ErrorError """ super(Error, self).__init__(**kwargs) self.error = error @@ -2707,7 +2945,7 @@ class ErrorError(msrest.serialization.Model): :ivar target: Error target. :vartype target: str :ivar details: Error details. - :vartype details: list[~stream_analytics_management_client.models.ErrorDetails] + :vartype details: list[~azure.mgmt.streamanalytics.models.ErrorDetails] """ _attribute_map = { @@ -2723,7 +2961,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ErrorDetails"]] = None, + details: Optional[List["_models.ErrorDetails"]] = None, **kwargs ): """ @@ -2734,7 +2972,7 @@ def __init__( :keyword target: Error target. :paramtype target: str :keyword details: Error details. - :paramtype details: list[~stream_analytics_management_client.models.ErrorDetails] + :paramtype details: list[~azure.mgmt.streamanalytics.models.ErrorDetails] """ super(ErrorError, self).__init__(**kwargs) self.code = code @@ -2787,10 +3025,9 @@ class ServiceBusDataSourceProperties(msrest.serialization.Model): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -2806,7 +3043,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -2819,10 +3056,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(ServiceBusDataSourceProperties, self).__init__(**kwargs) self.service_bus_namespace = service_bus_namespace @@ -2843,10 +3079,9 @@ class EventHubDataSourceProperties(ServiceBusDataSourceProperties): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str """ @@ -2865,7 +3100,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, **kwargs ): @@ -2879,10 +3114,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str """ @@ -2907,10 +3141,9 @@ class EventHubOutputDataSource(OutputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar partition_key: The key/column that is used to determine to which partition to send event @@ -2941,7 +3174,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, partition_key: Optional[str] = None, property_columns: Optional[List[str]] = None, @@ -2957,10 +3190,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword partition_key: The key/column that is used to determine to which partition to send @@ -2992,10 +3224,9 @@ class EventHubOutputDataSourceProperties(EventHubDataSourceProperties): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar partition_key: The key/column that is used to determine to which partition to send event @@ -3021,7 +3252,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, partition_key: Optional[str] = None, property_columns: Optional[List[str]] = None, @@ -3037,10 +3268,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword partition_key: The key/column that is used to determine to which partition to send @@ -3071,10 +3301,9 @@ class EventHubStreamInputDataSource(StreamInputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar consumer_group_name: The name of an Event Hub Consumer Group that should be used to read @@ -3104,7 +3333,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, consumer_group_name: Optional[str] = None, **kwargs @@ -3119,10 +3348,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword consumer_group_name: The name of an Event Hub Consumer Group that should be used to @@ -3153,10 +3381,9 @@ class EventHubStreamInputDataSourceProperties(EventHubDataSourceProperties): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar consumer_group_name: The name of an Event Hub Consumer Group that should be used to read @@ -3181,7 +3408,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, consumer_group_name: Optional[str] = None, **kwargs @@ -3196,10 +3423,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword consumer_group_name: The name of an Event Hub Consumer Group that should be used to @@ -3229,10 +3455,9 @@ class EventHubV2OutputDataSource(OutputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar partition_key: The key/column that is used to determine to which partition to send event @@ -3263,7 +3488,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, partition_key: Optional[str] = None, property_columns: Optional[List[str]] = None, @@ -3279,10 +3504,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword partition_key: The key/column that is used to determine to which partition to send @@ -3319,10 +3543,9 @@ class EventHubV2StreamInputDataSource(StreamInputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :vartype event_hub_name: str :ivar consumer_group_name: The name of an Event Hub Consumer Group that should be used to read @@ -3352,7 +3575,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", event_hub_name: Optional[str] = None, consumer_group_name: Optional[str] = None, **kwargs @@ -3367,10 +3590,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword event_hub_name: The name of the Event Hub. Required on PUT (CreateOrReplace) requests. :paramtype event_hub_name: str :keyword consumer_group_name: The name of an Event Hub Consumer Group that should be used to @@ -3389,6 +3611,42 @@ def __init__( self.consumer_group_name = consumer_group_name +class FileReferenceInputDataSource(ReferenceInputDataSource): + """Describes a file input data source that contains reference data. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Indicates the type of input data source containing reference data. + Required on PUT (CreateOrReplace) requests.Constant filled by server. + :vartype type: str + :ivar path: The path of the file. + :vartype path: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'path': {'key': 'properties.path', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + **kwargs + ): + """ + :keyword path: The path of the file. + :paramtype path: str + """ + super(FileReferenceInputDataSource, self).__init__(**kwargs) + self.type = 'File' # type: str + self.path = path + + class SubResource(msrest.serialization.Model): """The base sub-resource model definition. @@ -3441,7 +3699,7 @@ class Function(SubResource): :ivar type: Resource type. :vartype type: str :ivar properties: The properties that are associated with a function. - :vartype properties: ~stream_analytics_management_client.models.FunctionProperties + :vartype properties: ~azure.mgmt.streamanalytics.models.FunctionProperties """ _validation = { @@ -3460,14 +3718,14 @@ def __init__( self, *, name: Optional[str] = None, - properties: Optional["FunctionProperties"] = None, + properties: Optional["_models.FunctionProperties"] = None, **kwargs ): """ :keyword name: Resource name. :paramtype name: str :keyword properties: The properties that are associated with a function. - :paramtype properties: ~stream_analytics_management_client.models.FunctionProperties + :paramtype properties: ~azure.mgmt.streamanalytics.models.FunctionProperties """ super(Function, self).__init__(name=name, **kwargs) self.properties = properties @@ -3517,7 +3775,7 @@ class FunctionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of functions under a streaming job. Populated by a 'List' operation. - :vartype value: list[~stream_analytics_management_client.models.Function] + :vartype value: list[~azure.mgmt.streamanalytics.models.Function] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -3572,52 +3830,156 @@ def __init__( self.data_type = data_type -class FunctionProperties(msrest.serialization.Model): - """The properties that are associated with a function. +class GatewayMessageBusOutputDataSource(OutputDataSource): + """Describes a Gateway Message Bus output data source. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ScalarFunctionProperties. + All required parameters must be populated in order to send to Azure. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar type: Required. Indicates the type of data source output will be written to. Required on + PUT (CreateOrReplace) requests.Constant filled by server. + :vartype type: str + :ivar topic: The name of the Service Bus topic. + :vartype topic: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'topic': {'key': 'properties.topic', 'type': 'str'}, + } + + def __init__( + self, + *, + topic: Optional[str] = None, + **kwargs + ): + """ + :keyword topic: The name of the Service Bus topic. + :paramtype topic: str + """ + super(GatewayMessageBusOutputDataSource, self).__init__(**kwargs) + self.type = 'GatewayMessageBus' # type: str + self.topic = topic + + +class GatewayMessageBusSourceProperties(msrest.serialization.Model): + """The properties that are associated with a gateway message bus datasource. + + :ivar topic: The name of the Service Bus topic. + :vartype topic: str + """ + + _attribute_map = { + 'topic': {'key': 'topic', 'type': 'str'}, + } + + def __init__( + self, + *, + topic: Optional[str] = None, + **kwargs + ): + """ + :keyword topic: The name of the Service Bus topic. + :paramtype topic: str + """ + super(GatewayMessageBusSourceProperties, self).__init__(**kwargs) + self.topic = topic + + +class GatewayMessageBusOutputDataSourceProperties(GatewayMessageBusSourceProperties): + """The properties that are associated with a Gateway Message Bus. + + :ivar topic: The name of the Service Bus topic. + :vartype topic: str + """ + + _attribute_map = { + 'topic': {'key': 'topic', 'type': 'str'}, + } + + def __init__( + self, + *, + topic: Optional[str] = None, + **kwargs + ): + """ + :keyword topic: The name of the Service Bus topic. + :paramtype topic: str + """ + super(GatewayMessageBusOutputDataSourceProperties, self).__init__(topic=topic, **kwargs) + + +class GatewayMessageBusStreamInputDataSource(StreamInputDataSource): + """Describes a blob input data source that contains stream data. All required parameters must be populated in order to send to Azure. - :ivar type: Required. Indicates the type of function.Constant filled by server. + :ivar type: Required. Indicates the type of input data source containing stream data. Required + on PUT (CreateOrReplace) requests.Constant filled by server. :vartype type: str - :ivar etag: The current entity tag for the function. This is an opaque string. You can use it - to detect whether the resource has changed between requests. You can also use it in the - If-Match or If-None-Match headers for write operations for optimistic concurrency. - :vartype etag: str + :ivar topic: The name of the Service Bus topic. + :vartype topic: str """ _validation = { 'type': {'required': True}, - 'etag': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, + 'topic': {'key': 'properties.topic', 'type': 'str'}, } - _subtype_map = { - 'type': {'Scalar': 'ScalarFunctionProperties'} + def __init__( + self, + *, + topic: Optional[str] = None, + **kwargs + ): + """ + :keyword topic: The name of the Service Bus topic. + :paramtype topic: str + """ + super(GatewayMessageBusStreamInputDataSource, self).__init__(**kwargs) + self.type = 'GatewayMessageBus' # type: str + self.topic = topic + + +class GatewayMessageBusStreamInputDataSourceProperties(GatewayMessageBusSourceProperties): + """The properties that are associated with a gateway message bus input containing stream data. + + :ivar topic: The name of the Service Bus topic. + :vartype topic: str + """ + + _attribute_map = { + 'topic': {'key': 'topic', 'type': 'str'}, } def __init__( self, + *, + topic: Optional[str] = None, **kwargs ): """ + :keyword topic: The name of the Service Bus topic. + :paramtype topic: str """ - super(FunctionProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.etag = None + super(GatewayMessageBusStreamInputDataSourceProperties, self).__init__(topic=topic, **kwargs) class Identity(msrest.serialization.Model): """Describes how identity is verified. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar tenant_id: The identity tenantId. :vartype tenant_id: str :ivar principal_id: The identity principal ID. @@ -3626,6 +3988,11 @@ class Identity(msrest.serialization.Model): :vartype type: str """ + _validation = { + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + } + _attribute_map = { 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, @@ -3635,22 +4002,16 @@ class Identity(msrest.serialization.Model): def __init__( self, *, - tenant_id: Optional[str] = None, - principal_id: Optional[str] = None, type: Optional[str] = None, **kwargs ): """ - :keyword tenant_id: The identity tenantId. - :paramtype tenant_id: str - :keyword principal_id: The identity principal ID. - :paramtype principal_id: str :keyword type: The identity type. :paramtype type: str """ super(Identity, self).__init__(**kwargs) - self.tenant_id = tenant_id - self.principal_id = principal_id + self.tenant_id = None + self.principal_id = None self.type = type @@ -3667,7 +4028,7 @@ class Input(SubResource): :vartype type: str :ivar properties: The properties that are associated with an input. Required on PUT (CreateOrReplace) requests. - :vartype properties: ~stream_analytics_management_client.models.InputProperties + :vartype properties: ~azure.mgmt.streamanalytics.models.InputProperties """ _validation = { @@ -3686,7 +4047,7 @@ def __init__( self, *, name: Optional[str] = None, - properties: Optional["InputProperties"] = None, + properties: Optional["_models.InputProperties"] = None, **kwargs ): """ @@ -3694,7 +4055,7 @@ def __init__( :paramtype name: str :keyword properties: The properties that are associated with an input. Required on PUT (CreateOrReplace) requests. - :paramtype properties: ~stream_analytics_management_client.models.InputProperties + :paramtype properties: ~azure.mgmt.streamanalytics.models.InputProperties """ super(Input, self).__init__(name=name, **kwargs) self.properties = properties @@ -3706,7 +4067,7 @@ class InputListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of inputs under a streaming job. Populated by a 'List' operation. - :vartype value: list[~stream_analytics_management_client.models.Input] + :vartype value: list[~azure.mgmt.streamanalytics.models.Input] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -3747,16 +4108,16 @@ class InputProperties(msrest.serialization.Model): :vartype type: str :ivar serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :vartype serialization: ~stream_analytics_management_client.models.Serialization + :vartype serialization: ~azure.mgmt.streamanalytics.models.Serialization :ivar diagnostics: Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. - :vartype diagnostics: ~stream_analytics_management_client.models.Diagnostics + :vartype diagnostics: ~azure.mgmt.streamanalytics.models.Diagnostics :ivar etag: The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. :vartype etag: str :ivar compression: Describes how input data is compressed. - :vartype compression: ~stream_analytics_management_client.models.Compression + :vartype compression: ~azure.mgmt.streamanalytics.models.Compression :ivar partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :vartype partition_key: str @@ -3784,17 +4145,17 @@ class InputProperties(msrest.serialization.Model): def __init__( self, *, - serialization: Optional["Serialization"] = None, - compression: Optional["Compression"] = None, + serialization: Optional["_models.Serialization"] = None, + compression: Optional["_models.Compression"] = None, partition_key: Optional[str] = None, **kwargs ): """ :keyword serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :paramtype serialization: ~stream_analytics_management_client.models.Serialization + :paramtype serialization: ~azure.mgmt.streamanalytics.models.Serialization :keyword compression: Describes how input data is compressed. - :paramtype compression: ~stream_analytics_management_client.models.Compression + :paramtype compression: ~azure.mgmt.streamanalytics.models.Compression :keyword partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :paramtype partition_key: str @@ -4012,10 +4373,9 @@ class JobStorageAccount(StorageAccount): :ivar account_key: The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. :vartype account_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -4029,7 +4389,7 @@ def __init__( *, account_name: Optional[str] = None, account_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -4039,10 +4399,9 @@ def __init__( :keyword account_key: The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. :paramtype account_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(JobStorageAccount, self).__init__(account_name=account_name, account_key=account_key, **kwargs) self.authentication_mode = authentication_mode @@ -4054,21 +4413,20 @@ class JsonSerialization(Serialization): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of serialization that the input or output uses. - Required on PUT (CreateOrReplace) requests.Constant filled by server. Possible values include: - "Csv", "Avro", "Json", "Parquet". - :vartype type: str or ~stream_analytics_management_client.models.EventSerializationType + Required on PUT (CreateOrReplace) requests.Constant filled by server. Known values are: "Csv", + "Avro", "Json", "Parquet". + :vartype type: str or ~azure.mgmt.streamanalytics.models.EventSerializationType :ivar encoding: Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. - Possible values include: "UTF8". - :vartype encoding: str or ~stream_analytics_management_client.models.Encoding + Known values are: "UTF8". + :vartype encoding: str or ~azure.mgmt.streamanalytics.models.Encoding :ivar format: This property only applies to JSON serialization of outputs only. It is not applicable to inputs. This property specifies the format of the JSON the output will be written in. The currently supported values are 'lineSeparated' indicating the output will be formatted by having each JSON object separated by a new line and 'array' indicating the output will be - formatted as an array of JSON objects. Default value is 'lineSeparated' if left null. Possible - values include: "LineSeparated", "Array". - :vartype format: str or - ~stream_analytics_management_client.models.JsonOutputSerializationFormat + formatted as an array of JSON objects. Default value is 'lineSeparated' if left null. Known + values are: "LineSeparated", "Array". + :vartype format: str or ~azure.mgmt.streamanalytics.models.JsonOutputSerializationFormat """ _validation = { @@ -4084,23 +4442,22 @@ class JsonSerialization(Serialization): def __init__( self, *, - encoding: Optional[Union[str, "Encoding"]] = None, - format: Optional[Union[str, "JsonOutputSerializationFormat"]] = None, + encoding: Optional[Union[str, "_models.Encoding"]] = None, + format: Optional[Union[str, "_models.JsonOutputSerializationFormat"]] = None, **kwargs ): """ :keyword encoding: Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. - Possible values include: "UTF8". - :paramtype encoding: str or ~stream_analytics_management_client.models.Encoding + Known values are: "UTF8". + :paramtype encoding: str or ~azure.mgmt.streamanalytics.models.Encoding :keyword format: This property only applies to JSON serialization of outputs only. It is not applicable to inputs. This property specifies the format of the JSON the output will be written in. The currently supported values are 'lineSeparated' indicating the output will be formatted by having each JSON object separated by a new line and 'array' indicating the output will be - formatted as an array of JSON objects. Default value is 'lineSeparated' if left null. Possible - values include: "LineSeparated", "Array". - :paramtype format: str or - ~stream_analytics_management_client.models.JsonOutputSerializationFormat + formatted as an array of JSON objects. Default value is 'lineSeparated' if left null. Known + values are: "LineSeparated", "Array". + :paramtype format: str or ~azure.mgmt.streamanalytics.models.JsonOutputSerializationFormat """ super(JsonSerialization, self).__init__(**kwargs) self.type = 'Json' # type: str @@ -4119,7 +4476,7 @@ class Operation(msrest.serialization.Model): :vartype is_data_action: bool :ivar display: Contains the localized display information for this particular operation / action. - :vartype display: ~stream_analytics_management_client.models.OperationDisplay + :vartype display: ~azure.mgmt.streamanalytics.models.OperationDisplay """ _validation = { @@ -4199,7 +4556,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of Stream Analytics operations supported by the Microsoft.StreamAnalytics resource provider. - :vartype value: list[~stream_analytics_management_client.models.Operation] + :vartype value: list[~azure.mgmt.streamanalytics.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -4238,17 +4595,17 @@ class Output(SubResource): :vartype type: str :ivar datasource: Describes the data source that output will be written to. Required on PUT (CreateOrReplace) requests. - :vartype datasource: ~stream_analytics_management_client.models.OutputDataSource + :vartype datasource: ~azure.mgmt.streamanalytics.models.OutputDataSource :ivar time_window: The time frame for filtering Stream Analytics job outputs. :vartype time_window: str :ivar size_window: The size window to constrain a Stream Analytics output to. :vartype size_window: float :ivar serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :vartype serialization: ~stream_analytics_management_client.models.Serialization + :vartype serialization: ~azure.mgmt.streamanalytics.models.Serialization :ivar diagnostics: Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. - :vartype diagnostics: ~stream_analytics_management_client.models.Diagnostics + :vartype diagnostics: ~azure.mgmt.streamanalytics.models.Diagnostics :ivar etag: The current entity tag for the output. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. @@ -4278,10 +4635,10 @@ def __init__( self, *, name: Optional[str] = None, - datasource: Optional["OutputDataSource"] = None, + datasource: Optional["_models.OutputDataSource"] = None, time_window: Optional[str] = None, size_window: Optional[float] = None, - serialization: Optional["Serialization"] = None, + serialization: Optional["_models.Serialization"] = None, **kwargs ): """ @@ -4289,14 +4646,14 @@ def __init__( :paramtype name: str :keyword datasource: Describes the data source that output will be written to. Required on PUT (CreateOrReplace) requests. - :paramtype datasource: ~stream_analytics_management_client.models.OutputDataSource + :paramtype datasource: ~azure.mgmt.streamanalytics.models.OutputDataSource :keyword time_window: The time frame for filtering Stream Analytics job outputs. :paramtype time_window: str :keyword size_window: The size window to constrain a Stream Analytics output to. :paramtype size_window: float :keyword serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :paramtype serialization: ~stream_analytics_management_client.models.Serialization + :paramtype serialization: ~azure.mgmt.streamanalytics.models.Serialization """ super(Output, self).__init__(name=name, **kwargs) self.datasource = datasource @@ -4313,7 +4670,7 @@ class OutputListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of outputs under a streaming job. Populated by a 'List' operation. - :vartype value: list[~stream_analytics_management_client.models.Output] + :vartype value: list[~azure.mgmt.streamanalytics.models.Output] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -4345,9 +4702,9 @@ class ParquetSerialization(Serialization): All required parameters must be populated in order to send to Azure. :ivar type: Required. Indicates the type of serialization that the input or output uses. - Required on PUT (CreateOrReplace) requests.Constant filled by server. Possible values include: - "Csv", "Avro", "Json", "Parquet". - :vartype type: str or ~stream_analytics_management_client.models.EventSerializationType + Required on PUT (CreateOrReplace) requests.Constant filled by server. Known values are: "Csv", + "Avro", "Json", "Parquet". + :vartype type: str or ~azure.mgmt.streamanalytics.models.EventSerializationType :ivar properties: The properties that are associated with the Parquet serialization type. Required on PUT (CreateOrReplace) requests. :vartype properties: any @@ -4411,10 +4768,9 @@ class PowerBIOutputDataSource(OutputDataSource): :ivar group_name: The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. :vartype group_name: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _validation = { @@ -4443,7 +4799,7 @@ def __init__( table: Optional[str] = None, group_id: Optional[str] = None, group_name: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -4472,10 +4828,9 @@ def __init__( :keyword group_name: The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. :paramtype group_name: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(PowerBIOutputDataSource, self).__init__(**kwargs) self.type = 'PowerBI' # type: str @@ -4517,10 +4872,9 @@ class PowerBIOutputDataSourceProperties(OAuthBasedDataSourceProperties): :ivar group_name: The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. :vartype group_name: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ _attribute_map = { @@ -4544,7 +4898,7 @@ def __init__( table: Optional[str] = None, group_id: Optional[str] = None, group_name: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", **kwargs ): """ @@ -4573,10 +4927,9 @@ def __init__( :keyword group_name: The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. :paramtype group_name: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode """ super(PowerBIOutputDataSourceProperties, self).__init__(refresh_token=refresh_token, token_user_principal_name=token_user_principal_name, token_user_display_name=token_user_display_name, **kwargs) self.dataset = dataset @@ -4644,7 +4997,7 @@ class PrivateEndpoint(ProxyResource): :ivar manual_private_link_service_connections: A list of connections to the remote resource. Immutable after it is set. :vartype manual_private_link_service_connections: - list[~stream_analytics_management_client.models.PrivateLinkServiceConnection] + list[~azure.mgmt.streamanalytics.models.PrivateLinkServiceConnection] """ _validation = { @@ -4667,14 +5020,14 @@ class PrivateEndpoint(ProxyResource): def __init__( self, *, - manual_private_link_service_connections: Optional[List["PrivateLinkServiceConnection"]] = None, + manual_private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = None, **kwargs ): """ :keyword manual_private_link_service_connections: A list of connections to the remote resource. Immutable after it is set. :paramtype manual_private_link_service_connections: - list[~stream_analytics_management_client.models.PrivateLinkServiceConnection] + list[~azure.mgmt.streamanalytics.models.PrivateLinkServiceConnection] """ super(PrivateEndpoint, self).__init__(**kwargs) self.etag = None @@ -4688,7 +5041,7 @@ class PrivateEndpointListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of private endpoints. - :vartype value: list[~stream_analytics_management_client.models.PrivateEndpoint] + :vartype value: list[~azure.mgmt.streamanalytics.models.PrivateEndpoint] :ivar next_link: The URL to fetch the next set of private endpoints. :vartype next_link: str """ @@ -4770,7 +5123,7 @@ class PrivateLinkServiceConnection(msrest.serialization.Model): :ivar private_link_service_connection_state: A collection of read-only information about the state of the connection to the private remote resource. :vartype private_link_service_connection_state: - ~stream_analytics_management_client.models.PrivateLinkConnectionState + ~azure.mgmt.streamanalytics.models.PrivateLinkConnectionState """ _validation = { @@ -4789,7 +5142,7 @@ def __init__( *, private_link_service_id: Optional[str] = None, group_ids: Optional[List[str]] = None, - private_link_service_connection_state: Optional["PrivateLinkConnectionState"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkConnectionState"] = None, **kwargs ): """ @@ -4802,7 +5155,7 @@ def __init__( :keyword private_link_service_connection_state: A collection of read-only information about the state of the connection to the private remote resource. :paramtype private_link_service_connection_state: - ~stream_analytics_management_client.models.PrivateLinkConnectionState + ~azure.mgmt.streamanalytics.models.PrivateLinkConnectionState """ super(PrivateLinkServiceConnection, self).__init__(**kwargs) self.private_link_service_id = private_link_service_id @@ -4823,22 +5176,22 @@ class ReferenceInputProperties(InputProperties): :vartype type: str :ivar serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :vartype serialization: ~stream_analytics_management_client.models.Serialization + :vartype serialization: ~azure.mgmt.streamanalytics.models.Serialization :ivar diagnostics: Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. - :vartype diagnostics: ~stream_analytics_management_client.models.Diagnostics + :vartype diagnostics: ~azure.mgmt.streamanalytics.models.Diagnostics :ivar etag: The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. :vartype etag: str :ivar compression: Describes how input data is compressed. - :vartype compression: ~stream_analytics_management_client.models.Compression + :vartype compression: ~azure.mgmt.streamanalytics.models.Compression :ivar partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :vartype partition_key: str :ivar datasource: Describes an input data source that contains reference data. Required on PUT (CreateOrReplace) requests. - :vartype datasource: ~stream_analytics_management_client.models.ReferenceInputDataSource + :vartype datasource: ~azure.mgmt.streamanalytics.models.ReferenceInputDataSource """ _validation = { @@ -4860,24 +5213,24 @@ class ReferenceInputProperties(InputProperties): def __init__( self, *, - serialization: Optional["Serialization"] = None, - compression: Optional["Compression"] = None, + serialization: Optional["_models.Serialization"] = None, + compression: Optional["_models.Compression"] = None, partition_key: Optional[str] = None, - datasource: Optional["ReferenceInputDataSource"] = None, + datasource: Optional["_models.ReferenceInputDataSource"] = None, **kwargs ): """ :keyword serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :paramtype serialization: ~stream_analytics_management_client.models.Serialization + :paramtype serialization: ~azure.mgmt.streamanalytics.models.Serialization :keyword compression: Describes how input data is compressed. - :paramtype compression: ~stream_analytics_management_client.models.Compression + :paramtype compression: ~azure.mgmt.streamanalytics.models.Compression :keyword partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :paramtype partition_key: str :keyword datasource: Describes an input data source that contains reference data. Required on PUT (CreateOrReplace) requests. - :paramtype datasource: ~stream_analytics_management_client.models.ReferenceInputDataSource + :paramtype datasource: ~azure.mgmt.streamanalytics.models.ReferenceInputDataSource """ super(ReferenceInputProperties, self).__init__(serialization=serialization, compression=compression, partition_key=partition_key, **kwargs) self.type = 'Reference' # type: str @@ -4892,7 +5245,7 @@ class ResourceTestStatus(msrest.serialization.Model): :ivar status: The status of the test operation. :vartype status: str :ivar error: Describes the error that occurred. - :vartype error: ~stream_analytics_management_client.models.ErrorResponse + :vartype error: ~azure.mgmt.streamanalytics.models.ErrorResponse """ _validation = { @@ -4929,13 +5282,13 @@ class ScalarFunctionProperties(FunctionProperties): to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. :vartype etag: str - :ivar inputs: A list of inputs describing the parameters of the function. - :vartype inputs: list[~stream_analytics_management_client.models.FunctionInput] - :ivar output: The output of the function. - :vartype output: ~stream_analytics_management_client.models.FunctionOutput + :ivar inputs: + :vartype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :ivar output: Describes the output of a function. + :vartype output: ~azure.mgmt.streamanalytics.models.FunctionOutput :ivar binding: The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. - :vartype binding: ~stream_analytics_management_client.models.FunctionBinding + :vartype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding """ _validation = { @@ -4954,25 +5307,22 @@ class ScalarFunctionProperties(FunctionProperties): def __init__( self, *, - inputs: Optional[List["FunctionInput"]] = None, - output: Optional["FunctionOutput"] = None, - binding: Optional["FunctionBinding"] = None, + inputs: Optional[List["_models.FunctionInput"]] = None, + output: Optional["_models.FunctionOutput"] = None, + binding: Optional["_models.FunctionBinding"] = None, **kwargs ): """ - :keyword inputs: A list of inputs describing the parameters of the function. - :paramtype inputs: list[~stream_analytics_management_client.models.FunctionInput] - :keyword output: The output of the function. - :paramtype output: ~stream_analytics_management_client.models.FunctionOutput + :keyword inputs: + :paramtype inputs: list[~azure.mgmt.streamanalytics.models.FunctionInput] + :keyword output: Describes the output of a function. + :paramtype output: ~azure.mgmt.streamanalytics.models.FunctionOutput :keyword binding: The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. - :paramtype binding: ~stream_analytics_management_client.models.FunctionBinding + :paramtype binding: ~azure.mgmt.streamanalytics.models.FunctionBinding """ - super(ScalarFunctionProperties, self).__init__(**kwargs) + super(ScalarFunctionProperties, self).__init__(inputs=inputs, output=output, binding=binding, **kwargs) self.type = 'Scalar' # type: str - self.inputs = inputs - self.output = output - self.binding = binding class ScaleStreamingJobParameters(msrest.serialization.Model): @@ -5019,10 +5369,9 @@ class ServiceBusQueueOutputDataSource(OutputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar queue_name: The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. :vartype queue_name: str @@ -5057,7 +5406,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", queue_name: Optional[str] = None, property_columns: Optional[List[str]] = None, system_property_columns: Optional[Any] = None, @@ -5073,10 +5422,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword queue_name: The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. :paramtype queue_name: str @@ -5112,10 +5460,9 @@ class ServiceBusQueueOutputDataSourceProperties(ServiceBusDataSourceProperties): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar queue_name: The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. :vartype queue_name: str @@ -5145,7 +5492,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", queue_name: Optional[str] = None, property_columns: Optional[List[str]] = None, system_property_columns: Optional[Any] = None, @@ -5161,10 +5508,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword queue_name: The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. :paramtype queue_name: str @@ -5200,10 +5546,9 @@ class ServiceBusTopicOutputDataSource(OutputDataSource): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar topic_name: The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. :vartype topic_name: str @@ -5238,7 +5583,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", topic_name: Optional[str] = None, property_columns: Optional[List[str]] = None, system_property_columns: Optional[Dict[str, str]] = None, @@ -5254,10 +5599,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword topic_name: The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. :paramtype topic_name: str @@ -5293,10 +5637,9 @@ class ServiceBusTopicOutputDataSourceProperties(ServiceBusDataSourceProperties): :ivar shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :vartype shared_access_policy_key: str - :ivar authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :vartype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :ivar authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :vartype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :ivar topic_name: The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. :vartype topic_name: str @@ -5326,7 +5669,7 @@ def __init__( service_bus_namespace: Optional[str] = None, shared_access_policy_name: Optional[str] = None, shared_access_policy_key: Optional[str] = None, - authentication_mode: Optional[Union[str, "AuthenticationMode"]] = None, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = "ConnectionString", topic_name: Optional[str] = None, property_columns: Optional[List[str]] = None, system_property_columns: Optional[Dict[str, str]] = None, @@ -5342,10 +5685,9 @@ def __init__( :keyword shared_access_policy_key: The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. :paramtype shared_access_policy_key: str - :keyword authentication_mode: Authentication Mode. Possible values include: "Msi", "UserToken", - "ConnectionString". - :paramtype authentication_mode: str or - ~stream_analytics_management_client.models.AuthenticationMode + :keyword authentication_mode: Authentication Mode. Known values are: "Msi", "UserToken", + "ConnectionString". Default value: "ConnectionString". + :paramtype authentication_mode: str or ~azure.mgmt.streamanalytics.models.AuthenticationMode :keyword topic_name: The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. :paramtype topic_name: str @@ -5367,9 +5709,9 @@ def __init__( class Sku(msrest.serialization.Model): """The properties that are associated with a SKU. - :ivar name: The name of the SKU. Required on PUT (CreateOrReplace) requests. Possible values - include: "Standard". - :vartype name: str or ~stream_analytics_management_client.models.SkuName + :ivar name: The name of the SKU. Required on PUT (CreateOrReplace) requests. Known values are: + "Standard". + :vartype name: str or ~azure.mgmt.streamanalytics.models.SkuName """ _attribute_map = { @@ -5379,13 +5721,13 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "SkuName"]] = None, + name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs ): """ - :keyword name: The name of the SKU. Required on PUT (CreateOrReplace) requests. Possible values - include: "Standard". - :paramtype name: str or ~stream_analytics_management_client.models.SkuName + :keyword name: The name of the SKU. Required on PUT (CreateOrReplace) requests. Known values + are: "Standard". + :paramtype name: str or ~azure.mgmt.streamanalytics.models.SkuName """ super(Sku, self).__init__(**kwargs) self.name = name @@ -5397,9 +5739,9 @@ class StartStreamingJobParameters(msrest.serialization.Model): :ivar output_start_mode: Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime property, or start - from the last event output time. Possible values include: "JobStartTime", "CustomTime", + from the last event output time. Known values are: "JobStartTime", "CustomTime", "LastOutputEventTime". - :vartype output_start_mode: str or ~stream_analytics_management_client.models.OutputStartMode + :vartype output_start_mode: str or ~azure.mgmt.streamanalytics.models.OutputStartMode :ivar output_start_time: Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if @@ -5415,7 +5757,7 @@ class StartStreamingJobParameters(msrest.serialization.Model): def __init__( self, *, - output_start_mode: Optional[Union[str, "OutputStartMode"]] = None, + output_start_mode: Optional[Union[str, "_models.OutputStartMode"]] = None, output_start_time: Optional[datetime.datetime] = None, **kwargs ): @@ -5423,9 +5765,9 @@ def __init__( :keyword output_start_mode: Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime property, or start - from the last event output time. Possible values include: "JobStartTime", "CustomTime", + from the last event output time. Known values are: "JobStartTime", "CustomTime", "LastOutputEventTime". - :paramtype output_start_mode: str or ~stream_analytics_management_client.models.OutputStartMode + :paramtype output_start_mode: str or ~azure.mgmt.streamanalytics.models.OutputStartMode :keyword output_start_time: Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if @@ -5456,9 +5798,9 @@ class StreamingJob(TrackedResource): :vartype location: str :ivar identity: Describes the system-assigned managed identity assigned to this job that can be used to authenticate with inputs and outputs. - :vartype identity: ~stream_analytics_management_client.models.Identity + :vartype identity: ~azure.mgmt.streamanalytics.models.Identity :ivar sku: Describes the SKU of the streaming job. Required on PUT (CreateOrReplace) requests. - :vartype sku: ~stream_analytics_management_client.models.Sku + :vartype sku: ~azure.mgmt.streamanalytics.models.Sku :ivar job_id: A GUID uniquely identifying the streaming job. This GUID is generated upon creation of the streaming job. :vartype job_id: str @@ -5466,16 +5808,16 @@ class StreamingJob(TrackedResource): :vartype provisioning_state: str :ivar job_state: Describes the state of the streaming job. :vartype job_state: str - :ivar job_type: Describes the type of the job. Valid modes are ``Cloud`` and 'Edge'. Possible - values include: "Cloud", "Edge". - :vartype job_type: str or ~stream_analytics_management_client.models.JobType + :ivar job_type: Describes the type of the job. Valid modes are ``Cloud`` and 'Edge'. Known + values are: "Cloud", "Edge". + :vartype job_type: str or ~azure.mgmt.streamanalytics.models.JobType :ivar output_start_mode: This property should only be utilized when it is desired that the job be started immediately upon creation. Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the - outputStartTime property, or start from the last event output time. Possible values include: + outputStartTime property, or start from the last event output time. Known values are: "JobStartTime", "CustomTime", "LastOutputEventTime". - :vartype output_start_mode: str or ~stream_analytics_management_client.models.OutputStartMode + :vartype output_start_mode: str or ~azure.mgmt.streamanalytics.models.OutputStartMode :ivar output_start_time: Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if @@ -5487,14 +5829,13 @@ class StreamingJob(TrackedResource): set. :vartype last_output_event_time: ~datetime.datetime :ivar events_out_of_order_policy: Indicates the policy to apply to events that arrive out of - order in the input event stream. Possible values include: "Adjust", "Drop". + order in the input event stream. Known values are: "Adjust", "Drop". :vartype events_out_of_order_policy: str or - ~stream_analytics_management_client.models.EventsOutOfOrderPolicy + ~azure.mgmt.streamanalytics.models.EventsOutOfOrderPolicy :ivar output_error_policy: Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed (missing column values, - column values of wrong type or size). Possible values include: "Stop", "Drop". - :vartype output_error_policy: str or - ~stream_analytics_management_client.models.OutputErrorPolicy + column values of wrong type or size). Known values are: "Stop", "Drop". + :vartype output_error_policy: str or ~azure.mgmt.streamanalytics.models.OutputErrorPolicy :ivar events_out_of_order_max_delay_in_seconds: The maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. :vartype events_out_of_order_max_delay_in_seconds: int @@ -5508,45 +5849,43 @@ class StreamingJob(TrackedResource): https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx. Defaults to 'en-US' if none specified. :vartype data_locale: str - :ivar compatibility_level: Controls certain runtime behaviors of the streaming job. Possible - values include: "1.0", "1.2". - :vartype compatibility_level: str or - ~stream_analytics_management_client.models.CompatibilityLevel + :ivar compatibility_level: Controls certain runtime behaviors of the streaming job. Known + values are: "1.0", "1.2". + :vartype compatibility_level: str or ~azure.mgmt.streamanalytics.models.CompatibilityLevel :ivar created_date: Value is an ISO-8601 formatted UTC timestamp indicating when the streaming job was created. :vartype created_date: ~datetime.datetime :ivar inputs: A list of one or more inputs to the streaming job. The name property for each input is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual input. - :vartype inputs: list[~stream_analytics_management_client.models.Input] + :vartype inputs: list[~azure.mgmt.streamanalytics.models.Input] :ivar transformation: Indicates the query and the number of streaming units to use for the streaming job. The name property of the transformation is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. - :vartype transformation: ~stream_analytics_management_client.models.Transformation + :vartype transformation: ~azure.mgmt.streamanalytics.models.Transformation :ivar outputs: A list of one or more outputs for the streaming job. The name property for each output is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual output. - :vartype outputs: list[~stream_analytics_management_client.models.Output] + :vartype outputs: list[~azure.mgmt.streamanalytics.models.Output] :ivar functions: A list of one or more functions for the streaming job. The name property for each function is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. - :vartype functions: list[~stream_analytics_management_client.models.Function] + :vartype functions: list[~azure.mgmt.streamanalytics.models.Function] :ivar etag: The current entity tag for the streaming job. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. :vartype etag: str :ivar job_storage_account: The properties that are associated with an Azure Storage account with MSI. - :vartype job_storage_account: ~stream_analytics_management_client.models.JobStorageAccount + :vartype job_storage_account: ~azure.mgmt.streamanalytics.models.JobStorageAccount :ivar content_storage_policy: Valid values are JobStorageAccount and SystemAccount. If set to - JobStorageAccount, this requires the user to also specify jobStorageAccount property. . - Possible values include: "SystemAccount", "JobStorageAccount". - :vartype content_storage_policy: str or - ~stream_analytics_management_client.models.ContentStoragePolicy + JobStorageAccount, this requires the user to also specify jobStorageAccount property. . Known + values are: "SystemAccount", "JobStorageAccount". + :vartype content_storage_policy: str or ~azure.mgmt.streamanalytics.models.ContentStoragePolicy :ivar cluster: The cluster which streaming jobs will run on. - :vartype cluster: ~stream_analytics_management_client.models.ClusterInfo + :vartype cluster: ~azure.mgmt.streamanalytics.models.ClusterInfo """ _validation = { @@ -5598,24 +5937,24 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, - identity: Optional["Identity"] = None, - sku: Optional["Sku"] = None, - job_type: Optional[Union[str, "JobType"]] = None, - output_start_mode: Optional[Union[str, "OutputStartMode"]] = None, + identity: Optional["_models.Identity"] = None, + sku: Optional["_models.Sku"] = None, + job_type: Optional[Union[str, "_models.JobType"]] = None, + output_start_mode: Optional[Union[str, "_models.OutputStartMode"]] = None, output_start_time: Optional[datetime.datetime] = None, - events_out_of_order_policy: Optional[Union[str, "EventsOutOfOrderPolicy"]] = None, - output_error_policy: Optional[Union[str, "OutputErrorPolicy"]] = None, + events_out_of_order_policy: Optional[Union[str, "_models.EventsOutOfOrderPolicy"]] = None, + output_error_policy: Optional[Union[str, "_models.OutputErrorPolicy"]] = None, events_out_of_order_max_delay_in_seconds: Optional[int] = None, events_late_arrival_max_delay_in_seconds: Optional[int] = None, data_locale: Optional[str] = None, - compatibility_level: Optional[Union[str, "CompatibilityLevel"]] = None, - inputs: Optional[List["Input"]] = None, - transformation: Optional["Transformation"] = None, - outputs: Optional[List["Output"]] = None, - functions: Optional[List["Function"]] = None, - job_storage_account: Optional["JobStorageAccount"] = None, - content_storage_policy: Optional[Union[str, "ContentStoragePolicy"]] = None, - cluster: Optional["ClusterInfo"] = None, + compatibility_level: Optional[Union[str, "_models.CompatibilityLevel"]] = None, + inputs: Optional[List["_models.Input"]] = None, + transformation: Optional["_models.Transformation"] = None, + outputs: Optional[List["_models.Output"]] = None, + functions: Optional[List["_models.Function"]] = None, + job_storage_account: Optional["_models.JobStorageAccount"] = None, + content_storage_policy: Optional[Union[str, "_models.ContentStoragePolicy"]] = None, + cluster: Optional["_models.ClusterInfo"] = None, **kwargs ): """ @@ -5625,34 +5964,33 @@ def __init__( :paramtype location: str :keyword identity: Describes the system-assigned managed identity assigned to this job that can be used to authenticate with inputs and outputs. - :paramtype identity: ~stream_analytics_management_client.models.Identity + :paramtype identity: ~azure.mgmt.streamanalytics.models.Identity :keyword sku: Describes the SKU of the streaming job. Required on PUT (CreateOrReplace) requests. - :paramtype sku: ~stream_analytics_management_client.models.Sku - :keyword job_type: Describes the type of the job. Valid modes are ``Cloud`` and 'Edge'. - Possible values include: "Cloud", "Edge". - :paramtype job_type: str or ~stream_analytics_management_client.models.JobType + :paramtype sku: ~azure.mgmt.streamanalytics.models.Sku + :keyword job_type: Describes the type of the job. Valid modes are ``Cloud`` and 'Edge'. Known + values are: "Cloud", "Edge". + :paramtype job_type: str or ~azure.mgmt.streamanalytics.models.JobType :keyword output_start_mode: This property should only be utilized when it is desired that the job be started immediately upon creation. Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the - outputStartTime property, or start from the last event output time. Possible values include: + outputStartTime property, or start from the last event output time. Known values are: "JobStartTime", "CustomTime", "LastOutputEventTime". - :paramtype output_start_mode: str or ~stream_analytics_management_client.models.OutputStartMode + :paramtype output_start_mode: str or ~azure.mgmt.streamanalytics.models.OutputStartMode :keyword output_start_time: Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if outputStartMode is set to CustomTime. :paramtype output_start_time: ~datetime.datetime :keyword events_out_of_order_policy: Indicates the policy to apply to events that arrive out of - order in the input event stream. Possible values include: "Adjust", "Drop". + order in the input event stream. Known values are: "Adjust", "Drop". :paramtype events_out_of_order_policy: str or - ~stream_analytics_management_client.models.EventsOutOfOrderPolicy + ~azure.mgmt.streamanalytics.models.EventsOutOfOrderPolicy :keyword output_error_policy: Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed (missing column values, - column values of wrong type or size). Possible values include: "Stop", "Drop". - :paramtype output_error_policy: str or - ~stream_analytics_management_client.models.OutputErrorPolicy + column values of wrong type or size). Known values are: "Stop", "Drop". + :paramtype output_error_policy: str or ~azure.mgmt.streamanalytics.models.OutputErrorPolicy :keyword events_out_of_order_max_delay_in_seconds: The maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. :paramtype events_out_of_order_max_delay_in_seconds: int @@ -5666,38 +6004,37 @@ def __init__( https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx. Defaults to 'en-US' if none specified. :paramtype data_locale: str - :keyword compatibility_level: Controls certain runtime behaviors of the streaming job. Possible - values include: "1.0", "1.2". - :paramtype compatibility_level: str or - ~stream_analytics_management_client.models.CompatibilityLevel + :keyword compatibility_level: Controls certain runtime behaviors of the streaming job. Known + values are: "1.0", "1.2". + :paramtype compatibility_level: str or ~azure.mgmt.streamanalytics.models.CompatibilityLevel :keyword inputs: A list of one or more inputs to the streaming job. The name property for each input is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual input. - :paramtype inputs: list[~stream_analytics_management_client.models.Input] + :paramtype inputs: list[~azure.mgmt.streamanalytics.models.Input] :keyword transformation: Indicates the query and the number of streaming units to use for the streaming job. The name property of the transformation is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. - :paramtype transformation: ~stream_analytics_management_client.models.Transformation + :paramtype transformation: ~azure.mgmt.streamanalytics.models.Transformation :keyword outputs: A list of one or more outputs for the streaming job. The name property for each output is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual output. - :paramtype outputs: list[~stream_analytics_management_client.models.Output] + :paramtype outputs: list[~azure.mgmt.streamanalytics.models.Output] :keyword functions: A list of one or more functions for the streaming job. The name property for each function is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. - :paramtype functions: list[~stream_analytics_management_client.models.Function] + :paramtype functions: list[~azure.mgmt.streamanalytics.models.Function] :keyword job_storage_account: The properties that are associated with an Azure Storage account with MSI. - :paramtype job_storage_account: ~stream_analytics_management_client.models.JobStorageAccount + :paramtype job_storage_account: ~azure.mgmt.streamanalytics.models.JobStorageAccount :keyword content_storage_policy: Valid values are JobStorageAccount and SystemAccount. If set to JobStorageAccount, this requires the user to also specify jobStorageAccount property. . - Possible values include: "SystemAccount", "JobStorageAccount". + Known values are: "SystemAccount", "JobStorageAccount". :paramtype content_storage_policy: str or - ~stream_analytics_management_client.models.ContentStoragePolicy + ~azure.mgmt.streamanalytics.models.ContentStoragePolicy :keyword cluster: The cluster which streaming jobs will run on. - :paramtype cluster: ~stream_analytics_management_client.models.ClusterInfo + :paramtype cluster: ~azure.mgmt.streamanalytics.models.ClusterInfo """ super(StreamingJob, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity @@ -5732,7 +6069,7 @@ class StreamingJobListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of streaming jobs. Populated by a 'List' operation. - :vartype value: list[~stream_analytics_management_client.models.StreamingJob] + :vartype value: list[~azure.mgmt.streamanalytics.models.StreamingJob] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -5770,22 +6107,22 @@ class StreamInputProperties(InputProperties): :vartype type: str :ivar serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :vartype serialization: ~stream_analytics_management_client.models.Serialization + :vartype serialization: ~azure.mgmt.streamanalytics.models.Serialization :ivar diagnostics: Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. - :vartype diagnostics: ~stream_analytics_management_client.models.Diagnostics + :vartype diagnostics: ~azure.mgmt.streamanalytics.models.Diagnostics :ivar etag: The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. :vartype etag: str :ivar compression: Describes how input data is compressed. - :vartype compression: ~stream_analytics_management_client.models.Compression + :vartype compression: ~azure.mgmt.streamanalytics.models.Compression :ivar partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :vartype partition_key: str :ivar datasource: Describes an input data source that contains stream data. Required on PUT (CreateOrReplace) requests. - :vartype datasource: ~stream_analytics_management_client.models.StreamInputDataSource + :vartype datasource: ~azure.mgmt.streamanalytics.models.StreamInputDataSource """ _validation = { @@ -5807,24 +6144,24 @@ class StreamInputProperties(InputProperties): def __init__( self, *, - serialization: Optional["Serialization"] = None, - compression: Optional["Compression"] = None, + serialization: Optional["_models.Serialization"] = None, + compression: Optional["_models.Compression"] = None, partition_key: Optional[str] = None, - datasource: Optional["StreamInputDataSource"] = None, + datasource: Optional["_models.StreamInputDataSource"] = None, **kwargs ): """ :keyword serialization: Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. - :paramtype serialization: ~stream_analytics_management_client.models.Serialization + :paramtype serialization: ~azure.mgmt.streamanalytics.models.Serialization :keyword compression: Describes how input data is compressed. - :paramtype compression: ~stream_analytics_management_client.models.Compression + :paramtype compression: ~azure.mgmt.streamanalytics.models.Compression :keyword partition_key: partitionKey Describes a key in the input data which is used for partitioning the input data. :paramtype partition_key: str :keyword datasource: Describes an input data source that contains stream data. Required on PUT (CreateOrReplace) requests. - :paramtype datasource: ~stream_analytics_management_client.models.StreamInputDataSource + :paramtype datasource: ~azure.mgmt.streamanalytics.models.StreamInputDataSource """ super(StreamInputProperties, self).__init__(serialization=serialization, compression=compression, partition_key=partition_key, **kwargs) self.type = 'Stream' # type: str @@ -5884,7 +6221,7 @@ class SubscriptionQuotasListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of quotas for the subscription in a particular region. - :vartype value: list[~stream_analytics_management_client.models.SubscriptionQuota] + :vartype value: list[~azure.mgmt.streamanalytics.models.SubscriptionQuota] """ _validation = { @@ -5950,7 +6287,7 @@ def __init__( self, *, name: Optional[str] = None, - streaming_units: Optional[int] = None, + streaming_units: Optional[int] = 3, valid_streaming_units: Optional[List[int]] = None, query: Optional[str] = None, **kwargs diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_patch.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_stream_analytics_management_client_enums.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_stream_analytics_management_client_enums.py index 289651ecbed5..7585f584fbda 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_stream_analytics_management_client_enums.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/models/_stream_analytics_management_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AuthenticationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Authentication Mode. Valid modes are ``ConnectionString``\ , ``Msi`` and 'UserToken'. """ @@ -19,7 +18,7 @@ class AuthenticationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_TOKEN = "UserToken" CONNECTION_STRING = "ConnectionString" -class ClusterProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the cluster provisioning. The three terminal states are: Succeeded, Failed and Canceled """ @@ -33,21 +32,21 @@ class ClusterProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum #: The cluster provisioning was inprogress. IN_PROGRESS = "InProgress" -class ClusterSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) requests. """ #: The default SKU. DEFAULT = "Default" -class CompatibilityLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CompatibilityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Controls certain runtime behaviors of the streaming job. """ ONE0 = "1.0" ONE2 = "1.2" -class CompressionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CompressionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of compression that the input uses. Required on PUT (CreateOrReplace) requests. """ @@ -56,7 +55,7 @@ class CompressionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): G_ZIP = "GZip" DEFLATE = "Deflate" -class ContentStoragePolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContentStoragePolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Valid values are JobStorageAccount and SystemAccount. If set to JobStorageAccount, this requires the user to also specify jobStorageAccount property. . """ @@ -64,14 +63,14 @@ class ContentStoragePolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ACCOUNT = "SystemAccount" JOB_STORAGE_ACCOUNT = "JobStorageAccount" -class Encoding(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Encoding(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. """ UTF8 = "UTF8" -class EventSerializationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EventSerializationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of serialization that the input or output uses. Required on PUT (CreateOrReplace) requests. """ @@ -81,14 +80,14 @@ class EventSerializationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) JSON = "Json" PARQUET = "Parquet" -class EventsOutOfOrderPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EventsOutOfOrderPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the policy to apply to events that arrive out of order in the input event stream. """ ADJUST = "Adjust" DROP = "Drop" -class JobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JobState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current execution state of the streaming job. """ @@ -113,14 +112,14 @@ class JobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The job is currently in the Scaling state. SCALING = "Scaling" -class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the type of the job. Valid modes are ``Cloud`` and 'Edge'. """ CLOUD = "Cloud" EDGE = "Edge" -class JsonOutputSerializationFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonOutputSerializationFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the format of the JSON the output will be written in. The currently supported values are 'lineSeparated' indicating the output will be formatted by having each JSON object separated by a new line and 'array' indicating the output will be formatted as an array of JSON @@ -130,7 +129,7 @@ class JsonOutputSerializationFormat(with_metaclass(CaseInsensitiveEnumMeta, str, LINE_SEPARATED = "LineSeparated" ARRAY = "Array" -class OutputErrorPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutputErrorPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed (missing column values, column values of wrong type or size). @@ -139,7 +138,7 @@ class OutputErrorPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STOP = "Stop" DROP = "Drop" -class OutputStartMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutputStartMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime property, or start from the last event output @@ -150,7 +149,7 @@ class OutputStartMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CUSTOM_TIME = "CustomTime" LAST_OUTPUT_EVENT_TIME = "LastOutputEventTime" -class RefreshType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RefreshType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of data refresh option. """ @@ -158,7 +157,7 @@ class RefreshType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REFRESH_PERIODICALLY_WITH_FULL = "RefreshPeriodicallyWithFull" REFRESH_PERIODICALLY_WITH_DELTA = "RefreshPeriodicallyWithDelta" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the SKU. Required on PUT (CreateOrReplace) requests. """ diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/__init__.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/__init__.py index 72cfdc41ec92..0a7f15bac1ac 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/__init__.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/__init__.py @@ -16,6 +16,9 @@ from ._clusters_operations import ClustersOperations from ._private_endpoints_operations import PrivateEndpointsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'StreamingJobsOperations', @@ -27,3 +30,5 @@ 'ClustersOperations', 'PrivateEndpointsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_clusters_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_clusters_operations.py index 9928bd14e86b..ddace9624f31 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_clusters_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,45 +34,46 @@ def build_create_or_update_request_initial( resource_group_name: str, cluster_name: str, *, - json: JSONType = None, + json: Optional[_models.Cluster] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -84,42 +85,43 @@ def build_update_request_initial( resource_group_name: str, cluster_name: str, *, - json: JSONType = None, + json: Optional[_models.Cluster] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -132,31 +134,33 @@ def build_get_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -167,31 +171,33 @@ def build_delete_request_initial( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -200,29 +206,31 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -232,30 +240,32 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -266,72 +276,76 @@ def build_list_streaming_jobs_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class ClustersOperations(object): - """ClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] _json = self._serialize.body(cluster, 'Cluster') @@ -339,16 +353,23 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -366,7 +387,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace @@ -374,11 +395,11 @@ def begin_create_or_update( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller["_models.Cluster"]: + ) -> LROPoller[_models.Cluster]: """Creates a Stream Analytics Cluster or replaces an already existing cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -387,13 +408,14 @@ def begin_create_or_update( :type cluster_name: str :param cluster: The definition of the cluster that will be used to create a new cluster or replace the existing one. - :type cluster: ~stream_analytics_management_client.models.Cluster + :type cluster: ~azure.mgmt.streamanalytics.models.Cluster :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response. + Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -404,40 +426,52 @@ def begin_create_or_update( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.Cluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.Cluster] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, cluster=cluster, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -446,26 +480,29 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore def _update_initial( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, **kwargs: Any - ) -> Optional["_models.Cluster"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + ) -> Optional[_models.Cluster]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Cluster]] _json = self._serialize.body(cluster, 'Cluster') @@ -473,15 +510,22 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -497,7 +541,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace @@ -505,10 +549,10 @@ def begin_update( self, resource_group_name: str, cluster_name: str, - cluster: "_models.Cluster", + cluster: _models.Cluster, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller["_models.Cluster"]: + ) -> LROPoller[_models.Cluster]: """Updates an existing cluster. This can be used to partially update (ie. update one or two properties) a cluster without affecting the rest of the cluster definition. @@ -518,10 +562,10 @@ def begin_update( :type cluster_name: str :param cluster: The properties specified here will overwrite the corresponding properties in the existing cluster (ie. Those properties will be updated). - :type cluster: ~stream_analytics_management_client.models.Cluster + :type cluster: ~azure.mgmt.streamanalytics.models.Cluster :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -532,39 +576,51 @@ def begin_update( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.Cluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.Cluster] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, cluster=cluster, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,10 +629,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace def get( @@ -584,7 +639,7 @@ def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.Cluster": + ) -> _models.Cluster: """Gets information about the specified cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -593,26 +648,38 @@ def get( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Cluster + :rtype: ~azure.mgmt.streamanalytics.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -627,32 +694,44 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -662,11 +741,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -690,18 +769,25 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -711,8 +797,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -721,47 +813,56 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"} # type: ignore @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.ClusterListResult"]: + ) -> Iterable[_models.ClusterListResult]: """Lists all of the clusters in the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.ClusterListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -775,7 +876,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -789,49 +894,59 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters"} # type: ignore @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ClusterListResult"]: + ) -> Iterable[_models.ClusterListResult]: """Lists all of the clusters in the given resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.ClusterListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -845,7 +960,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -859,7 +978,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters"} # type: ignore @distributed_trace def list_streaming_jobs( @@ -867,7 +986,7 @@ def list_streaming_jobs( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ClusterJobListResult"]: + ) -> Iterable[_models.ClusterJobListResult]: """Lists all of the streaming jobs in the given cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -877,15 +996,19 @@ def list_streaming_jobs( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterJobListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.ClusterJobListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.ClusterJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -893,10 +1016,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_streaming_jobs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -904,10 +1030,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -921,7 +1050,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -935,4 +1068,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_streaming_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs'} # type: ignore + list_streaming_jobs.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_functions_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_functions_operations.py index 8e88d2424a6a..8c33e0b181d3 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_functions_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_functions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,18 +35,21 @@ def build_create_or_replace_request( job_name: str, function_name: str, *, - json: JSONType = None, + json: Optional[_models.Function] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -54,27 +57,25 @@ def build_create_or_replace_request( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -87,17 +88,20 @@ def build_update_request( job_name: str, function_name: str, *, - json: JSONType = None, + json: Optional[_models.Function] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -105,25 +109,23 @@ def build_update_request( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -137,10 +139,14 @@ def build_delete_request( function_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -148,21 +154,19 @@ def build_delete_request( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -174,10 +178,14 @@ def build_get_request( function_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -185,21 +193,19 @@ def build_get_request( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -212,33 +218,35 @@ def build_list_by_streaming_job_request( select: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$select'] = _SERIALIZER.query("select", select, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -249,16 +257,19 @@ def build_test_request_initial( job_name: str, function_name: str, *, - json: JSONType = None, + json: Optional[_models.Function] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -266,23 +277,21 @@ def build_test_request_initial( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -295,16 +304,19 @@ def build_retrieve_default_definition_request( job_name: str, function_name: str, *, - json: JSONType = None, + json: Optional[_models.FunctionRetrieveDefaultDefinitionParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -312,49 +324,45 @@ def build_retrieve_default_definition_request( "functionName": _SERIALIZER.url("function_name", function_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class FunctionsOperations(object): - """FunctionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class FunctionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`functions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -362,11 +370,11 @@ def create_or_replace( resource_group_name: str, job_name: str, function_name: str, - function: "_models.Function", + function: _models.Function, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Creates a function or replaces an already existing function under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -377,26 +385,31 @@ def create_or_replace( :type function_name: str :param function: The definition of the function that will be used to create a new function or replace the existing one under the streaming job. - :type function: ~stream_analytics_management_client.models.Function + :type function: ~azure.mgmt.streamanalytics.models.Function :param if_match: The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new function to be created, but to prevent updating - an existing function. Other values will result in a 412 Pre-condition Failed response. + an existing function. Other values will result in a 412 Pre-condition Failed response. Default + value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] _json = self._serialize.body(function, 'Function') @@ -405,16 +418,23 @@ def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -438,7 +458,7 @@ def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace @@ -447,10 +467,10 @@ def update( resource_group_name: str, job_name: str, function_name: str, - function: "_models.Function", + function: _models.Function, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Updates an existing function under an existing streaming job. This can be used to partially update (ie. update one or two properties) a function without affecting the rest the job or function definition. @@ -465,23 +485,27 @@ def update( corresponding properties in the existing function (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing function will remain the same and not change as a result of this PATCH operation. - :type function: ~stream_analytics_management_client.models.Function + :type function: ~azure.mgmt.streamanalytics.models.Function :param if_match: The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] _json = self._serialize.body(function, 'Function') @@ -490,15 +514,22 @@ def update( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,11 +547,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -540,11 +571,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -552,12 +588,19 @@ def delete( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -568,7 +611,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace @@ -578,7 +621,7 @@ def get( job_name: str, function_name: str, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Gets details about the specified function. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -589,14 +632,19 @@ def get( :type function_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] request = build_get_request( @@ -604,12 +652,19 @@ def get( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -627,7 +682,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"} # type: ignore @distributed_trace @@ -637,7 +692,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.FunctionListResult"]: + ) -> Iterable[_models.FunctionListResult]: """Lists all of the functions under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -647,18 +702,23 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FunctionListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.FunctionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.FunctionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FunctionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FunctionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -666,11 +726,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -678,11 +741,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -696,7 +762,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -710,23 +780,27 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions"} # type: ignore def _test_initial( self, resource_group_name: str, job_name: str, function_name: str, - function: Optional["_models.Function"] = None, + function: Optional[_models.Function] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if function is not None: _json = self._serialize.body(function, 'Function') @@ -738,14 +812,21 @@ def _test_initial( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -761,7 +842,7 @@ def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test"} # type: ignore @distributed_trace @@ -770,9 +851,9 @@ def begin_test( resource_group_name: str, job_name: str, function_name: str, - function: Optional["_models.Function"] = None, + function: Optional[_models.Function] = None, **kwargs: Any - ) -> LROPoller["_models.ResourceTestStatus"]: + ) -> LROPoller[_models.ResourceTestStatus]: """Tests if the information provided for a function is valid. This can range from testing the connection to the underlying web service behind the function or making sure the function code provided is syntactically correct. @@ -787,8 +868,9 @@ def begin_test( the full function definition intended to be tested. If the function specified already exists, this parameter can be left null to test the existing function as is or if specified, the properties specified will overwrite the corresponding properties in the existing function - (exactly like a PATCH operation) and the resulting function will be tested. - :type function: ~stream_analytics_management_client.models.Function + (exactly like a PATCH operation) and the resulting function will be tested. Default value is + None. + :type function: ~azure.mgmt.streamanalytics.models.Function :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -799,40 +881,51 @@ def begin_test( Retry-After header is present. :return: An instance of LROPoller that returns either ResourceTestStatus or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._test_initial( + raw_result = self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, function=function, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -841,10 +934,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test"} # type: ignore @distributed_trace def retrieve_default_definition( @@ -852,9 +944,9 @@ def retrieve_default_definition( resource_group_name: str, job_name: str, function_name: str, - function_retrieve_default_definition_parameters: Optional["_models.FunctionRetrieveDefaultDefinitionParameters"] = None, + function_retrieve_default_definition_parameters: Optional[_models.FunctionRetrieveDefaultDefinitionParameters] = None, **kwargs: Any - ) -> "_models.Function": + ) -> _models.Function: """Retrieves the default definition of a function based on the parameters specified. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -864,21 +956,25 @@ def retrieve_default_definition( :param function_name: The name of the function. :type function_name: str :param function_retrieve_default_definition_parameters: Parameters used to specify the type of - function to retrieve the default definition for. + function to retrieve the default definition for. Default value is None. :type function_retrieve_default_definition_parameters: - ~stream_analytics_management_client.models.FunctionRetrieveDefaultDefinitionParameters + ~azure.mgmt.streamanalytics.models.FunctionRetrieveDefaultDefinitionParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Function, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Function + :rtype: ~azure.mgmt.streamanalytics.models.Function :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Function"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Function] if function_retrieve_default_definition_parameters is not None: _json = self._serialize.body(function_retrieve_default_definition_parameters, 'FunctionRetrieveDefaultDefinitionParameters') @@ -890,14 +986,21 @@ def retrieve_default_definition( resource_group_name=resource_group_name, job_name=job_name, function_name=function_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.retrieve_default_definition.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -912,5 +1015,5 @@ def retrieve_default_definition( return deserialized - retrieve_default_definition.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition'} # type: ignore + retrieve_default_definition.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_inputs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_inputs_operations.py index e38cfdfe309e..deef965c28ab 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_inputs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_inputs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,18 +35,21 @@ def build_create_or_replace_request( job_name: str, input_name: str, *, - json: JSONType = None, + json: Optional[_models.Input] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -54,27 +57,25 @@ def build_create_or_replace_request( "inputName": _SERIALIZER.url("input_name", input_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -87,17 +88,20 @@ def build_update_request( job_name: str, input_name: str, *, - json: JSONType = None, + json: Optional[_models.Input] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -105,25 +109,23 @@ def build_update_request( "inputName": _SERIALIZER.url("input_name", input_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -137,10 +139,14 @@ def build_delete_request( input_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -148,21 +154,19 @@ def build_delete_request( "inputName": _SERIALIZER.url("input_name", input_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -174,10 +178,14 @@ def build_get_request( input_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -185,21 +193,19 @@ def build_get_request( "inputName": _SERIALIZER.url("input_name", input_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -212,33 +218,35 @@ def build_list_by_streaming_job_request( select: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$select'] = _SERIALIZER.query("select", select, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -249,16 +257,19 @@ def build_test_request_initial( job_name: str, input_name: str, *, - json: JSONType = None, + json: Optional[_models.Input] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -266,49 +277,45 @@ def build_test_request_initial( "inputName": _SERIALIZER.url("input_name", input_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class InputsOperations(object): - """InputsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class InputsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`inputs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -316,11 +323,11 @@ def create_or_replace( resource_group_name: str, job_name: str, input_name: str, - input: "_models.Input", + input: _models.Input, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Creates an input or replaces an already existing input under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -331,25 +338,31 @@ def create_or_replace( :type input_name: str :param input: The definition of the input that will be used to create a new input or replace the existing one under the streaming job. - :type input: ~stream_analytics_management_client.models.Input + :type input: ~azure.mgmt.streamanalytics.models.Input :param if_match: The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. + Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new input to be created, but to prevent updating an - existing input. Other values will result in a 412 Pre-condition Failed response. + existing input. Other values will result in a 412 Pre-condition Failed response. Default value + is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] _json = self._serialize.body(input, 'Input') @@ -358,16 +371,23 @@ def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -391,7 +411,7 @@ def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace @@ -400,10 +420,10 @@ def update( resource_group_name: str, job_name: str, input_name: str, - input: "_models.Input", + input: _models.Input, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Updates an existing input under an existing streaming job. This can be used to partially update (ie. update one or two properties) an input without affecting the rest the job or input definition. @@ -418,22 +438,27 @@ def update( properties in the existing input (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing input will remain the same and not change as a result of this PATCH operation. - :type input: ~stream_analytics_management_client.models.Input + :type input: ~azure.mgmt.streamanalytics.models.Input :param if_match: The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. + Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] _json = self._serialize.body(input, 'Input') @@ -442,15 +467,22 @@ def update( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -468,11 +500,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -492,11 +524,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -504,12 +541,19 @@ def delete( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -520,7 +564,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace @@ -530,7 +574,7 @@ def get( job_name: str, input_name: str, **kwargs: Any - ) -> "_models.Input": + ) -> _models.Input: """Gets details about the specified input. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -541,14 +585,19 @@ def get( :type input_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Input, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Input + :rtype: ~azure.mgmt.streamanalytics.models.Input :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Input"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Input] request = build_get_request( @@ -556,12 +605,19 @@ def get( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -579,7 +635,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"} # type: ignore @distributed_trace @@ -589,7 +645,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.InputListResult"]: + ) -> Iterable[_models.InputListResult]: """Lists all of the inputs under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -599,18 +655,23 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either InputListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.InputListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.InputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.InputListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.InputListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -618,11 +679,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -630,11 +694,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -648,7 +715,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -662,23 +733,27 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs"} # type: ignore def _test_initial( self, resource_group_name: str, job_name: str, input_name: str, - input: Optional["_models.Input"] = None, + input: Optional[_models.Input] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if input is not None: _json = self._serialize.body(input, 'Input') @@ -690,14 +765,21 @@ def _test_initial( resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -713,7 +795,7 @@ def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test"} # type: ignore @distributed_trace @@ -722,9 +804,9 @@ def begin_test( resource_group_name: str, job_name: str, input_name: str, - input: Optional["_models.Input"] = None, + input: Optional[_models.Input] = None, **kwargs: Any - ) -> LROPoller["_models.ResourceTestStatus"]: + ) -> LROPoller[_models.ResourceTestStatus]: """Tests whether an input’s datasource is reachable and usable by the Azure Stream Analytics service. @@ -738,8 +820,8 @@ def begin_test( full input definition intended to be tested. If the input specified already exists, this parameter can be left null to test the existing input as is or if specified, the properties specified will overwrite the corresponding properties in the existing input (exactly like a - PATCH operation) and the resulting input will be tested. - :type input: ~stream_analytics_management_client.models.Input + PATCH operation) and the resulting input will be tested. Default value is None. + :type input: ~azure.mgmt.streamanalytics.models.Input :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -750,40 +832,51 @@ def begin_test( Retry-After header is present. :return: An instance of LROPoller that returns either ResourceTestStatus or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._test_initial( + raw_result = self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, input_name=input_name, input=input, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -792,7 +885,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_operations.py index b9c24b592305..6a63e106d8e8 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,83 +30,93 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.StreamAnalytics/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.StreamAnalytics/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Stream Analytics related operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,7 +130,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.StreamAnalytics/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.StreamAnalytics/operations"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_outputs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_outputs_operations.py index 8a05a16e4404..aa53f2134e44 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_outputs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_outputs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,18 +35,21 @@ def build_create_or_replace_request( job_name: str, output_name: str, *, - json: JSONType = None, + json: Optional[_models.Output] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -54,27 +57,25 @@ def build_create_or_replace_request( "outputName": _SERIALIZER.url("output_name", output_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -87,17 +88,20 @@ def build_update_request( job_name: str, output_name: str, *, - json: JSONType = None, + json: Optional[_models.Output] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -105,25 +109,23 @@ def build_update_request( "outputName": _SERIALIZER.url("output_name", output_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -137,10 +139,14 @@ def build_delete_request( output_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -148,21 +154,19 @@ def build_delete_request( "outputName": _SERIALIZER.url("output_name", output_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -174,10 +178,14 @@ def build_get_request( output_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -185,21 +193,19 @@ def build_get_request( "outputName": _SERIALIZER.url("output_name", output_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -212,33 +218,35 @@ def build_list_by_streaming_job_request( select: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$select'] = _SERIALIZER.query("select", select, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -249,16 +257,19 @@ def build_test_request_initial( job_name: str, output_name: str, *, - json: JSONType = None, + json: Optional[_models.Output] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -266,49 +277,45 @@ def build_test_request_initial( "outputName": _SERIALIZER.url("output_name", output_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class OutputsOperations(object): - """OutputsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OutputsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`outputs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -316,11 +323,11 @@ def create_or_replace( resource_group_name: str, job_name: str, output_name: str, - output: "_models.Output", + output: _models.Output, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Creates an output or replaces an already existing output under an existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -331,26 +338,31 @@ def create_or_replace( :type output_name: str :param output: The definition of the output that will be used to create a new output or replace the existing one under the streaming job. - :type output: ~stream_analytics_management_client.models.Output + :type output: ~azure.mgmt.streamanalytics.models.Output :param if_match: The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new output to be created, but to prevent updating - an existing output. Other values will result in a 412 Pre-condition Failed response. + an existing output. Other values will result in a 412 Pre-condition Failed response. Default + value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] _json = self._serialize.body(output, 'Output') @@ -359,16 +371,23 @@ def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -392,7 +411,7 @@ def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace @@ -401,10 +420,10 @@ def update( resource_group_name: str, job_name: str, output_name: str, - output: "_models.Output", + output: _models.Output, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Updates an existing output under an existing streaming job. This can be used to partially update (ie. update one or two properties) an output without affecting the rest the job or output definition. @@ -419,23 +438,27 @@ def update( properties in the existing output (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing output will remain the same and not change as a result of this PATCH operation. - :type output: ~stream_analytics_management_client.models.Output + :type output: ~azure.mgmt.streamanalytics.models.Output :param if_match: The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] _json = self._serialize.body(output, 'Output') @@ -444,15 +467,22 @@ def update( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -470,11 +500,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -494,11 +524,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -506,12 +541,19 @@ def delete( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -522,7 +564,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace @@ -532,7 +574,7 @@ def get( job_name: str, output_name: str, **kwargs: Any - ) -> "_models.Output": + ) -> _models.Output: """Gets details about the specified output. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -543,14 +585,19 @@ def get( :type output_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Output, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Output + :rtype: ~azure.mgmt.streamanalytics.models.Output :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Output"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Output] request = build_get_request( @@ -558,12 +605,19 @@ def get( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -581,7 +635,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"} # type: ignore @distributed_trace @@ -591,7 +645,7 @@ def list_by_streaming_job( job_name: str, select: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.OutputListResult"]: + ) -> Iterable[_models.OutputListResult]: """Lists all of the outputs under the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -601,18 +655,23 @@ def list_by_streaming_job( :param select: The $select OData query parameter. This is a comma-separated list of structural properties to include in the response, or "\ *" to include all properties. By default, all properties are returned except diagnostics. Currently only accepts '*\ ' as a valid value. + Default value is None. :type select: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutputListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.OutputListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.OutputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutputListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutputListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -620,11 +679,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=self.list_by_streaming_job.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -632,11 +694,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, select=select, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -650,7 +715,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -664,23 +733,27 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_streaming_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs'} # type: ignore + list_by_streaming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs"} # type: ignore def _test_initial( self, resource_group_name: str, job_name: str, output_name: str, - output: Optional["_models.Output"] = None, + output: Optional[_models.Output] = None, **kwargs: Any - ) -> Optional["_models.ResourceTestStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceTestStatus"]] + ) -> Optional[_models.ResourceTestStatus]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ResourceTestStatus]] if output is not None: _json = self._serialize.body(output, 'Output') @@ -692,14 +765,21 @@ def _test_initial( resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._test_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -715,7 +795,7 @@ def _test_initial( return deserialized - _test_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test'} # type: ignore + _test_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test"} # type: ignore @distributed_trace @@ -724,9 +804,9 @@ def begin_test( resource_group_name: str, job_name: str, output_name: str, - output: Optional["_models.Output"] = None, + output: Optional[_models.Output] = None, **kwargs: Any - ) -> LROPoller["_models.ResourceTestStatus"]: + ) -> LROPoller[_models.ResourceTestStatus]: """Tests whether an output’s datasource is reachable and usable by the Azure Stream Analytics service. @@ -740,8 +820,8 @@ def begin_test( full output definition intended to be tested. If the output specified already exists, this parameter can be left null to test the existing output as is or if specified, the properties specified will overwrite the corresponding properties in the existing output (exactly like a - PATCH operation) and the resulting output will be tested. - :type output: ~stream_analytics_management_client.models.Output + PATCH operation) and the resulting output will be tested. Default value is None. + :type output: ~azure.mgmt.streamanalytics.models.Output :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -752,40 +832,51 @@ def begin_test( Retry-After header is present. :return: An instance of LROPoller that returns either ResourceTestStatus or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.ResourceTestStatus] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.ResourceTestStatus] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceTestStatus"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceTestStatus] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._test_initial( + raw_result = self._test_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, output_name=output_name, output=output, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ResourceTestStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -794,7 +885,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test'} # type: ignore + begin_test.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_patch.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_private_endpoints_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_private_endpoints_operations.py index b81ea7d6cc1b..c0965ff2fefc 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_private_endpoints_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_private_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,18 +35,21 @@ def build_create_or_update_request( cluster_name: str, private_endpoint_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpoint] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -54,27 +57,25 @@ def build_create_or_update_request( "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -88,10 +89,14 @@ def build_get_request( private_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -99,21 +104,19 @@ def build_get_request( "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -125,10 +128,14 @@ def build_delete_request_initial( private_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -136,21 +143,19 @@ def build_delete_request_initial( "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -161,55 +166,55 @@ def build_list_by_cluster_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointsOperations(object): - """PrivateEndpointsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`private_endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_update( @@ -217,11 +222,11 @@ def create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_name: str, - private_endpoint: "_models.PrivateEndpoint", + private_endpoint: _models.PrivateEndpoint, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.PrivateEndpoint": + ) -> _models.PrivateEndpoint: """Creates a Stream Analytics Private Endpoint or replaces an already existing Private Endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -232,26 +237,31 @@ def create_or_update( :type private_endpoint_name: str :param private_endpoint: The definition of the private endpoint that will be used to create a new cluster or replace the existing one. - :type private_endpoint: ~stream_analytics_management_client.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :param if_match: The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response. + Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpoint, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.PrivateEndpoint + :rtype: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpoint] _json = self._serialize.body(private_endpoint, 'PrivateEndpoint') @@ -260,16 +270,23 @@ def create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -288,7 +305,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace @@ -298,7 +315,7 @@ def get( cluster_name: str, private_endpoint_name: str, **kwargs: Any - ) -> "_models.PrivateEndpoint": + ) -> _models.PrivateEndpoint: """Gets information about the specified Private Endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -309,14 +326,19 @@ def get( :type private_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpoint, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.PrivateEndpoint + :rtype: ~azure.mgmt.streamanalytics.models.PrivateEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpoint] request = build_get_request( @@ -324,12 +346,19 @@ def get( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,21 +373,26 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, private_endpoint_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -366,12 +400,19 @@ def _delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -381,11 +422,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -412,19 +453,26 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_name=private_endpoint_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -434,8 +482,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -444,10 +498,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"} # type: ignore @distributed_trace def list_by_cluster( @@ -455,7 +508,7 @@ def list_by_cluster( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointListResult"]: + ) -> Iterable[_models.PrivateEndpointListResult]: """Lists the private endpoints in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -466,14 +519,19 @@ def list_by_cluster( :return: An iterator like instance of either PrivateEndpointListResult or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.PrivateEndpointListResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.PrivateEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -481,10 +539,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -492,10 +553,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -509,7 +573,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -523,4 +591,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_streaming_jobs_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_streaming_jobs_operations.py index 881f5c78632c..aba2c94c23c9 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_streaming_jobs_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_streaming_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +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 functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,45 +34,46 @@ def build_create_or_replace_request_initial( resource_group_name: str, job_name: str, *, - json: JSONType = None, + json: Optional[_models.StreamingJob] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -84,42 +85,43 @@ def build_update_request( resource_group_name: str, job_name: str, *, - json: JSONType = None, + json: Optional[_models.StreamingJob] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -132,31 +134,33 @@ def build_delete_request_initial( job_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -169,33 +173,35 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -207,32 +213,34 @@ def build_list_by_resource_group_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -243,31 +251,33 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -277,39 +287,40 @@ def build_start_request_initial( resource_group_name: str, job_name: str, *, - json: JSONType = None, + json: Optional[_models.StartStreamingJobParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -322,31 +333,33 @@ def build_stop_request_initial( job_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -356,82 +369,85 @@ def build_scale_request_initial( resource_group_name: str, job_name: str, *, - json: JSONType = None, + json: Optional[_models.ScaleStreamingJobParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class StreamingJobsOperations(object): - """StreamingJobsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class StreamingJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`streaming_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _create_or_replace_initial( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] + ) -> _models.StreamingJob: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] _json = self._serialize.body(streaming_job, 'StreamingJob') @@ -439,16 +455,23 @@ def _create_or_replace_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self._create_or_replace_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -471,7 +494,7 @@ def _create_or_replace_initial( return deserialized - _create_or_replace_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + _create_or_replace_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace @@ -479,11 +502,11 @@ def begin_create_or_replace( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller["_models.StreamingJob"]: + ) -> LROPoller[_models.StreamingJob]: """Creates a streaming job or replaces an already existing streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -492,14 +515,14 @@ def begin_create_or_replace( :type job_name: str :param streaming_job: The definition of the streaming job that will be used to create a new streaming job or replace the existing one. - :type streaming_job: ~stream_analytics_management_client.models.StreamingJob + :type streaming_job: ~azure.mgmt.streamanalytics.models.StreamingJob :param if_match: The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new streaming job to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed - response. + response. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -511,26 +534,33 @@ def begin_create_or_replace( Retry-After header is present. :return: An instance of LROPoller that returns either StreamingJob or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~stream_analytics_management_client.models.StreamingJob] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.streamanalytics.models.StreamingJob] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_replace_initial( + raw_result = self._create_or_replace_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, streaming_job=streaming_job, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -546,8 +576,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -556,20 +592,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + begin_create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace def update( self, resource_group_name: str, job_name: str, - streaming_job: "_models.StreamingJob", + streaming_job: _models.StreamingJob, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": + ) -> _models.StreamingJob: """Updates an existing streaming job. This can be used to partially update (ie. update one or two properties) a streaming job without affecting the rest the job definition. @@ -581,23 +616,27 @@ def update( corresponding properties in the existing streaming job (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing input will remain the same and not change as a result of this PATCH operation. - :type streaming_job: ~stream_analytics_management_client.models.StreamingJob + :type streaming_job: ~azure.mgmt.streamanalytics.models.StreamingJob :param if_match: The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StreamingJob, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.StreamingJob + :rtype: ~azure.mgmt.streamanalytics.models.StreamingJob :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] _json = self._serialize.body(streaming_job, 'StreamingJob') @@ -605,15 +644,22 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,32 +677,44 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -666,11 +724,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -694,18 +752,25 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -715,8 +780,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -725,10 +796,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace def get( @@ -737,7 +807,7 @@ def get( job_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.StreamingJob": + ) -> _models.StreamingJob: """Gets details about the specified streaming job. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -747,31 +817,43 @@ def get( :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StreamingJob, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.StreamingJob + :rtype: ~azure.mgmt.streamanalytics.models.StreamingJob :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJob"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJob] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -789,7 +871,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"} # type: ignore @distributed_trace @@ -798,7 +880,7 @@ def list_by_resource_group( resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.StreamingJobListResult"]: + ) -> Iterable[_models.StreamingJobListResult]: """Lists all of the streaming jobs in the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -806,42 +888,52 @@ def list_by_resource_group( :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StreamingJobListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.StreamingJobListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.StreamingJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, expand=expand, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, expand=expand, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -855,7 +947,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -869,53 +965,63 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs"} # type: ignore @distributed_trace def list( self, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.StreamingJobListResult"]: + ) -> Iterable[_models.StreamingJobListResult]: """Lists all of the streaming jobs in the given subscription. :param expand: The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', - 'transformation', 'outputs', and 'functions'. + 'transformation', 'outputs', and 'functions'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StreamingJobListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~stream_analytics_management_client.models.StreamingJobListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.streamanalytics.models.StreamingJobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingJobListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StreamingJobListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -929,7 +1035,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -943,22 +1053,26 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - start_job_parameters: Optional["_models.StartStreamingJobParameters"] = None, + start_job_parameters: Optional[_models.StartStreamingJobParameters] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] if start_job_parameters is not None: _json = self._serialize.body(start_job_parameters, 'StartStreamingJobParameters') @@ -969,14 +1083,21 @@ def _start_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -986,15 +1107,15 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - start_job_parameters: Optional["_models.StartStreamingJobParameters"] = None, + start_job_parameters: Optional[_models.StartStreamingJobParameters] = None, **kwargs: Any ) -> LROPoller[None]: """Starts a streaming job. Once a job is started it will start processing input events and produce @@ -1004,9 +1125,9 @@ def begin_start( :type resource_group_name: str :param job_name: The name of the streaming job. :type job_name: str - :param start_job_parameters: Parameters applicable to a start streaming job operation. - :type start_job_parameters: - ~stream_analytics_management_client.models.StartStreamingJobParameters + :param start_job_parameters: Parameters applicable to a start streaming job operation. Default + value is None. + :type start_job_parameters: ~azure.mgmt.streamanalytics.models.StartStreamingJobParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1019,21 +1140,28 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, start_job_parameters=start_job_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1171,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1053,34 +1187,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1090,11 +1235,11 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop"} # type: ignore @distributed_trace - def begin_stop( + def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, @@ -1119,18 +1264,25 @@ def begin_stop( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1140,8 +1292,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1150,25 +1308,28 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop"} # type: ignore - def _scale_initial( + def _scale_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - scale_job_parameters: Optional["_models.ScaleStreamingJobParameters"] = None, + scale_job_parameters: Optional[_models.ScaleStreamingJobParameters] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] if scale_job_parameters is not None: _json = self._serialize.body(scale_job_parameters, 'ScaleStreamingJobParameters') @@ -1179,14 +1340,21 @@ def _scale_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, job_name=job_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._scale_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1196,15 +1364,15 @@ def _scale_initial( if cls: return cls(pipeline_response, None, {}) - _scale_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale'} # type: ignore + _scale_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale"} # type: ignore @distributed_trace - def begin_scale( + def begin_scale( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, - scale_job_parameters: Optional["_models.ScaleStreamingJobParameters"] = None, + scale_job_parameters: Optional[_models.ScaleStreamingJobParameters] = None, **kwargs: Any ) -> LROPoller[None]: """Scales a streaming job when the job is running. @@ -1213,9 +1381,9 @@ def begin_scale( :type resource_group_name: str :param job_name: The name of the streaming job. :type job_name: str - :param scale_job_parameters: Parameters applicable to a scale streaming job operation. - :type scale_job_parameters: - ~stream_analytics_management_client.models.ScaleStreamingJobParameters + :param scale_job_parameters: Parameters applicable to a scale streaming job operation. Default + value is None. + :type scale_job_parameters: ~azure.mgmt.streamanalytics.models.ScaleStreamingJobParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1228,21 +1396,28 @@ def begin_scale( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._scale_initial( + raw_result = self._scale_initial( # type: ignore resource_group_name=resource_group_name, job_name=job_name, scale_job_parameters=scale_job_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1252,8 +1427,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1262,7 +1443,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale'} # type: ignore + begin_scale.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/scale"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_subscriptions_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_subscriptions_operations.py index ad9588e88b47..8680f32598eb 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_subscriptions_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_subscriptions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,61 +31,61 @@ def build_list_quotas_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas") # pylint: disable=line-too-long path_format_arguments = { "location": _SERIALIZER.url("location", location, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class SubscriptionsOperations(object): - """SubscriptionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`subscriptions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_quotas( self, location: str, **kwargs: Any - ) -> "_models.SubscriptionQuotasListResult": + ) -> _models.SubscriptionQuotasListResult: """Retrieves the subscription's current quota information in a particular region. :param location: The region in which to retrieve the subscription's quota information. You can @@ -93,25 +94,37 @@ def list_quotas( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionQuotasListResult, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.SubscriptionQuotasListResult + :rtype: ~azure.mgmt.streamanalytics.models.SubscriptionQuotasListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionQuotasListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SubscriptionQuotasListResult] request = build_list_quotas_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_quotas.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,5 +139,5 @@ def list_quotas( return deserialized - list_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas'} # type: ignore + list_quotas.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas"} # type: ignore diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_transformations_operations.py b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_transformations_operations.py index 267cff4f5416..1e8119645579 100644 --- a/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_transformations_operations.py +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_transformations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,18 +32,21 @@ def build_create_or_replace_request( job_name: str, transformation_name: str, *, - json: JSONType = None, + json: Optional[_models.Transformation] = None, content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -51,27 +54,25 @@ def build_create_or_replace_request( "transformationName": _SERIALIZER.url("transformation_name", transformation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -84,17 +85,20 @@ def build_update_request( job_name: str, transformation_name: str, *, - json: JSONType = None, + json: Optional[_models.Transformation] = None, content: Any = None, if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2020-03-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -102,25 +106,23 @@ def build_update_request( "transformationName": _SERIALIZER.url("transformation_name", transformation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -134,10 +136,14 @@ def build_get_request( transformation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-03-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -145,45 +151,41 @@ def build_get_request( "transformationName": _SERIALIZER.url("transformation_name", transformation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class TransformationsOperations(object): - """TransformationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TransformationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~stream_analytics_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.streamanalytics.StreamAnalyticsManagementClient`'s + :attr:`transformations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 create_or_replace( @@ -191,11 +193,11 @@ def create_or_replace( resource_group_name: str, job_name: str, transformation_name: str, - transformation: "_models.Transformation", + transformation: _models.Transformation, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Creates a transformation or replaces an already existing transformation under an existing streaming job. @@ -207,27 +209,31 @@ def create_or_replace( :type transformation_name: str :param transformation: The definition of the transformation that will be used to create a new transformation or replace the existing one under the streaming job. - :type transformation: ~stream_analytics_management_client.models.Transformation + :type transformation: ~azure.mgmt.streamanalytics.models.Transformation :param if_match: The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. + concurrent changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new transformation to be created, but to prevent updating an existing transformation. Other values will result in a 412 Pre-condition Failed - response. + response. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] _json = self._serialize.body(transformation, 'Transformation') @@ -236,16 +242,23 @@ def create_or_replace( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, if_none_match=if_none_match, template_url=self.create_or_replace.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -269,7 +282,7 @@ def create_or_replace( return deserialized - create_or_replace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + create_or_replace.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore @distributed_trace @@ -278,10 +291,10 @@ def update( resource_group_name: str, job_name: str, transformation_name: str, - transformation: "_models.Transformation", + transformation: _models.Transformation, if_match: Optional[str] = None, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Updates an existing transformation under an existing streaming job. This can be used to partially update (ie. update one or two properties) a transformation without affecting the rest the job or transformation definition. @@ -297,23 +310,27 @@ def update( updated). Any properties that are set to null here will mean that the corresponding property in the existing transformation will remain the same and not change as a result of this PATCH operation. - :type transformation: ~stream_analytics_management_client.models.Transformation + :type transformation: ~azure.mgmt.streamanalytics.models.Transformation :param if_match: The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. + concurrent changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] _json = self._serialize.body(transformation, 'Transformation') @@ -322,15 +339,22 @@ def update( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -348,7 +372,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore @distributed_trace @@ -358,7 +382,7 @@ def get( job_name: str, transformation_name: str, **kwargs: Any - ) -> "_models.Transformation": + ) -> _models.Transformation: """Gets details about the specified transformation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -369,14 +393,19 @@ def get( :type transformation_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Transformation, or the result of cls(response) - :rtype: ~stream_analytics_management_client.models.Transformation + :rtype: ~azure.mgmt.streamanalytics.models.Transformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Transformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Transformation] request = build_get_request( @@ -384,12 +413,19 @@ def get( resource_group_name=resource_group_name, job_name=job_name, transformation_name=transformation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,5 +443,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"} # type: ignore