From aa3026e867b13eb05ab2d1bb349fdc79534af61e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 15 Mar 2022 03:18:24 +0000 Subject: [PATCH] CodeGen from PR 18192 in Azure/azure-rest-api-specs Merge 9e9ebca8314ed2dc8cd583bb6fb06945d6048c2f into 9aff6fbac1975af94f6a3bc415be84f67d3311ee --- sdk/scheduler/azure-mgmt-scheduler/_meta.json | 11 + .../azure/mgmt/scheduler/__init__.py | 9 +- .../azure/mgmt/scheduler/_configuration.py | 19 +- .../azure/mgmt/scheduler/_metadata.json | 103 ++ .../azure/mgmt/scheduler/_patch.py | 31 + .../scheduler/_scheduler_management_client.py | 73 +- .../azure/mgmt/scheduler/_vendor.py | 27 + .../azure/mgmt/scheduler/aio/__init__.py | 5 + .../mgmt/scheduler/aio/_configuration.py | 6 +- .../azure/mgmt/scheduler/aio/_patch.py | 31 + .../aio/_scheduler_management_client.py | 62 +- .../operations/_job_collections_operations.py | 403 +++--- .../aio/operations/_jobs_operations.py | 353 +++-- .../azure/mgmt/scheduler/models/__init__.py | 99 +- .../azure/mgmt/scheduler/models/_models.py | 1147 ----------------- .../mgmt/scheduler/models/_models_py3.py | 763 +++++++---- .../_scheduler_management_client_enums.py | 45 +- .../operations/_job_collections_operations.py | 746 +++++++---- .../scheduler/operations/_jobs_operations.py | 710 ++++++---- .../azure/mgmt/scheduler/patch.py | 55 - 20 files changed, 2211 insertions(+), 2487 deletions(-) create mode 100644 sdk/scheduler/azure-mgmt-scheduler/_meta.json create mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_metadata.json create mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_patch.py create mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_vendor.py create mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_patch.py delete mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models.py delete mode 100644 sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/patch.py diff --git a/sdk/scheduler/azure-mgmt-scheduler/_meta.json b/sdk/scheduler/azure-mgmt-scheduler/_meta.json new file mode 100644 index 000000000000..80159b763627 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "c76db05c209e7e3273990521da05e77fd774174b", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/scheduler/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", + "readme": "specification/scheduler/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/__init__.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/__init__.py index a48ff5a6de0b..eaa1c0e40bd5 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/__init__.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SchedulerManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_configuration.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_configuration.py index c4af5778a7de..239b324a3858 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_configuration.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SchedulerManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SchedulerManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SchedulerManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_metadata.json b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_metadata.json new file mode 100644 index 000000000000..2d8bd94b6b10 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "2016-03-01", + "total_api_version_list": ["2016-03-01"], + "client": { + "name": "SchedulerManagementClient", + "filename": "_scheduler_management_client", + "description": "SchedulerManagementClient.", + "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\": [\"SchedulerManagementClientConfiguration\"]}}, \"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\": [\"SchedulerManagementClientConfiguration\"]}}, \"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 subscription id.", + "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 subscription id.", + "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": { + "job_collections": "JobCollectionsOperations", + "jobs": "JobsOperations" + } +} \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_patch.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_scheduler_management_client.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_scheduler_management_client.py index 6b2f0e9b97ee..d8fe83f44c26 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_scheduler_management_client.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_scheduler_management_client.py @@ -6,24 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SchedulerManagementClientConfiguration +from .operations import JobCollectionsOperations, JobsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import SchedulerManagementClientConfiguration -from .operations import JobCollectionsOperations -from .operations import JobsOperations -from . import models - - -class SchedulerManagementClient(object): +class SchedulerManagementClient: """SchedulerManagementClient. :ivar job_collections: JobCollectionsOperations operations @@ -34,32 +32,55 @@ class SchedulerManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SchedulerManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SchedulerManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.job_collections = JobCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.job_collections = JobCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_vendor.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/__init__.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/__init__.py index f2d66228d602..12c0e1a30ef2 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/__init__.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/__init__.py @@ -8,3 +8,8 @@ from ._scheduler_management_client import SchedulerManagementClient __all__ = ['SchedulerManagementClient'] + +# `._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() diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_configuration.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_configuration.py index f38f8ef36053..4f2980837b1e 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_configuration.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SchedulerManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SchedulerManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_patch.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_scheduler_management_client.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_scheduler_management_client.py index 4c0b195e9c3f..c9e4d9a7af50 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_scheduler_management_client.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/_scheduler_management_client.py @@ -6,22 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SchedulerManagementClientConfiguration +from .operations import JobCollectionsOperations, JobsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SchedulerManagementClientConfiguration -from .operations import JobCollectionsOperations -from .operations import JobsOperations -from .. import models - - -class SchedulerManagementClient(object): +class SchedulerManagementClient: """SchedulerManagementClient. :ivar job_collections: JobCollectionsOperations operations @@ -32,31 +32,55 @@ class SchedulerManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SchedulerManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = SchedulerManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.job_collections = JobCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.job_collections = JobCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_job_collections_operations.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_job_collections_operations.py index 6558d657c261..c93817cce785 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_job_collections_operations.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_job_collections_operations.py @@ -5,19 +5,24 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._job_collections_operations import build_create_or_update_request, build_delete_request_initial, build_disable_request_initial, build_enable_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_patch_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +40,7 @@ class JobCollectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,50 +48,48 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs - ) -> AsyncIterable["models.JobCollectionListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.JobCollectionListResult"]: """Gets all job collections under specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] + :return: An iterator like instance of either JobCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollectionListResult', pipeline_response) + deserialized = self._deserialize("JobCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,59 +107,59 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.JobCollectionListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.JobCollectionListResult"]: """Gets all job collections under specified resource group. :param resource_group_name: The resource group name. :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 JobCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] + :return: An iterator like instance of either JobCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollectionListResult', pipeline_response) + deserialized = self._deserialize("JobCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,17 +177,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, job_collection_name: str, - **kwargs - ) -> "models.JobCollectionDefinition": + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Gets a job collection. :param resource_group_name: The resource group name. @@ -196,32 +201,22 @@ async def get( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -235,15 +230,18 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, job_collection_name: str, - job_collection: "models.JobCollectionDefinition", - **kwargs - ) -> "models.JobCollectionDefinition": + job_collection: "_models.JobCollectionDefinition", + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Provisions a new job collection or updates an existing job collection. :param resource_group_name: The resource group name. @@ -257,37 +255,27 @@ async def create_or_update( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(job_collection, 'JobCollectionDefinition') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_collection, 'JobCollectionDefinition') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -305,15 +293,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, job_collection_name: str, - job_collection: "models.JobCollectionDefinition", - **kwargs - ) -> "models.JobCollectionDefinition": + job_collection: "_models.JobCollectionDefinition", + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Patches an existing job collection. :param resource_group_name: The resource group name. @@ -327,37 +318,27 @@ async def patch( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(job_collection, 'JobCollectionDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_collection, 'JobCollectionDefinition') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -371,38 +352,32 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, job_collection_name: str, - **kwargs + **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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,11 +390,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, job_collection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a job collection. @@ -429,15 +406,17 @@ async def begin_delete( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -451,15 +430,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -471,38 +449,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore async def _enable_initial( self, resource_group_name: str, job_collection_name: str, - **kwargs + **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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._enable_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_enable_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._enable_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -515,11 +486,13 @@ async def _enable_initial( _enable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable'} # type: ignore + + @distributed_trace_async async def begin_enable( self, resource_group_name: str, job_collection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Enables all of the jobs in the job collection. @@ -529,15 +502,17 @@ async def begin_enable( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,15 +526,14 @@ async def begin_enable( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -571,38 +545,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable'} # type: ignore async def _disable_initial( self, resource_group_name: str, job_collection_name: str, - **kwargs + **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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._disable_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_disable_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._disable_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -615,11 +582,13 @@ async def _disable_initial( _disable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable'} # type: ignore + + @distributed_trace_async async def begin_disable( self, resource_group_name: str, job_collection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Disables all of the jobs in the job collection. @@ -629,15 +598,17 @@ async def begin_disable( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -651,15 +622,14 @@ async def begin_disable( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -671,4 +641,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable'} # type: ignore diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_jobs_operations.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_jobs_operations.py index a83f47978ea1..e56530ac0548 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_jobs_operations.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/aio/operations/_jobs_operations.py @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_job_history_request, build_list_request, build_patch_request, build_run_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class JobsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,13 +46,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, job_collection_name: str, job_name: str, - **kwargs - ) -> "models.JobDefinition": + **kwargs: Any + ) -> "_models.JobDefinition": """Gets a job. :param resource_group_name: The resource group name. @@ -61,33 +67,23 @@ async def get( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,16 +97,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, job_collection_name: str, job_name: str, - job: "models.JobDefinition", - **kwargs - ) -> "models.JobDefinition": + job: "_models.JobDefinition", + **kwargs: Any + ) -> "_models.JobDefinition": """Provisions a new job or updates an existing job. :param resource_group_name: The resource group name. @@ -126,38 +125,28 @@ async def create_or_update( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(job, 'JobDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job, 'JobDefinition') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,16 +164,19 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, job_collection_name: str, job_name: str, - job: "models.JobDefinition", - **kwargs - ) -> "models.JobDefinition": + job: "_models.JobDefinition", + **kwargs: Any + ) -> "_models.JobDefinition": """Patches an existing job. :param resource_group_name: The resource group name. @@ -200,38 +192,28 @@ async def patch( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(job, 'JobDefinition') + + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job, 'JobDefinition') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,14 +227,17 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, job_collection_name: str, job_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a job. @@ -272,26 +257,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,12 +281,14 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def run( self, resource_group_name: str, job_collection_name: str, job_name: str, - **kwargs + **kwargs: Any ) -> None: """Runs a job. @@ -329,26 +308,18 @@ async def run( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - - # Construct URL - url = self.run.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_run_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.run.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +332,8 @@ async def run( run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -368,8 +341,8 @@ def list( top: Optional[int] = None, skip: Optional[int] = None, filter: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.JobListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.JobListResult"]: """Lists all jobs under the specified job collection. :param resource_group_name: The resource group name. @@ -388,47 +361,44 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + top=top, + skip=skip, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + top=top, + skip=skip, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('JobListResult', pipeline_response) + deserialized = self._deserialize("JobListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -446,11 +416,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs'} # type: ignore + @distributed_trace def list_job_history( self, resource_group_name: str, @@ -459,8 +431,8 @@ def list_job_history( top: Optional[int] = None, skip: Optional[int] = None, filter: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.JobHistoryListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.JobHistoryListResult"]: """Lists job history. :param resource_group_name: The resource group name. @@ -477,52 +449,52 @@ def list_job_history( :param filter: The filter to apply on the job state. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobHistoryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobHistoryListResult] + :return: An iterator like instance of either JobHistoryListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scheduler.models.JobHistoryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobHistoryListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobHistoryListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_job_history.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_job_history_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + top=top, + skip=skip, + filter=filter, + template_url=self.list_job_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_job_history_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + top=top, + skip=skip, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('JobHistoryListResult', pipeline_response) + deserialized = self._deserialize("JobHistoryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -540,6 +512,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/__init__.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/__init__.py index bb265b2e5a88..f206a4be4181 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/__init__.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/__init__.py @@ -6,72 +6,39 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BasicAuthentication - from ._models_py3 import ClientCertAuthentication - from ._models_py3 import HttpAuthentication - from ._models_py3 import HttpRequest - from ._models_py3 import JobAction - from ._models_py3 import JobCollectionDefinition - from ._models_py3 import JobCollectionListResult - from ._models_py3 import JobCollectionProperties - from ._models_py3 import JobCollectionQuota - from ._models_py3 import JobDefinition - from ._models_py3 import JobErrorAction - from ._models_py3 import JobHistoryDefinition - from ._models_py3 import JobHistoryDefinitionProperties - from ._models_py3 import JobHistoryFilter - from ._models_py3 import JobHistoryListResult - from ._models_py3 import JobListResult - from ._models_py3 import JobMaxRecurrence - from ._models_py3 import JobProperties - from ._models_py3 import JobRecurrence - from ._models_py3 import JobRecurrenceSchedule - from ._models_py3 import JobRecurrenceScheduleMonthlyOccurrence - from ._models_py3 import JobStateFilter - from ._models_py3 import JobStatus - from ._models_py3 import OAuthAuthentication - from ._models_py3 import RetryPolicy - from ._models_py3 import ServiceBusAuthentication - from ._models_py3 import ServiceBusBrokeredMessageProperties - from ._models_py3 import ServiceBusMessage - from ._models_py3 import ServiceBusQueueMessage - from ._models_py3 import ServiceBusTopicMessage - from ._models_py3 import Sku - from ._models_py3 import StorageQueueMessage -except (SyntaxError, ImportError): - from ._models import BasicAuthentication # type: ignore - from ._models import ClientCertAuthentication # type: ignore - from ._models import HttpAuthentication # type: ignore - from ._models import HttpRequest # type: ignore - from ._models import JobAction # type: ignore - from ._models import JobCollectionDefinition # type: ignore - from ._models import JobCollectionListResult # type: ignore - from ._models import JobCollectionProperties # type: ignore - from ._models import JobCollectionQuota # type: ignore - from ._models import JobDefinition # type: ignore - from ._models import JobErrorAction # type: ignore - from ._models import JobHistoryDefinition # type: ignore - from ._models import JobHistoryDefinitionProperties # type: ignore - from ._models import JobHistoryFilter # type: ignore - from ._models import JobHistoryListResult # type: ignore - from ._models import JobListResult # type: ignore - from ._models import JobMaxRecurrence # type: ignore - from ._models import JobProperties # type: ignore - from ._models import JobRecurrence # type: ignore - from ._models import JobRecurrenceSchedule # type: ignore - from ._models import JobRecurrenceScheduleMonthlyOccurrence # type: ignore - from ._models import JobStateFilter # type: ignore - from ._models import JobStatus # type: ignore - from ._models import OAuthAuthentication # type: ignore - from ._models import RetryPolicy # type: ignore - from ._models import ServiceBusAuthentication # type: ignore - from ._models import ServiceBusBrokeredMessageProperties # type: ignore - from ._models import ServiceBusMessage # type: ignore - from ._models import ServiceBusQueueMessage # type: ignore - from ._models import ServiceBusTopicMessage # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageQueueMessage # type: ignore +from ._models_py3 import BasicAuthentication +from ._models_py3 import ClientCertAuthentication +from ._models_py3 import HttpAuthentication +from ._models_py3 import HttpRequest +from ._models_py3 import JobAction +from ._models_py3 import JobCollectionDefinition +from ._models_py3 import JobCollectionListResult +from ._models_py3 import JobCollectionProperties +from ._models_py3 import JobCollectionQuota +from ._models_py3 import JobDefinition +from ._models_py3 import JobErrorAction +from ._models_py3 import JobHistoryDefinition +from ._models_py3 import JobHistoryDefinitionProperties +from ._models_py3 import JobHistoryFilter +from ._models_py3 import JobHistoryListResult +from ._models_py3 import JobListResult +from ._models_py3 import JobMaxRecurrence +from ._models_py3 import JobProperties +from ._models_py3 import JobRecurrence +from ._models_py3 import JobRecurrenceSchedule +from ._models_py3 import JobRecurrenceScheduleMonthlyOccurrence +from ._models_py3 import JobStateFilter +from ._models_py3 import JobStatus +from ._models_py3 import OAuthAuthentication +from ._models_py3 import RetryPolicy +from ._models_py3 import ServiceBusAuthentication +from ._models_py3 import ServiceBusBrokeredMessageProperties +from ._models_py3 import ServiceBusMessage +from ._models_py3 import ServiceBusQueueMessage +from ._models_py3 import ServiceBusTopicMessage +from ._models_py3 import Sku +from ._models_py3 import StorageQueueMessage + from ._scheduler_management_client_enums import ( DayOfWeek, diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models.py deleted file mode 100644 index 5d735efdd986..000000000000 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models.py +++ /dev/null @@ -1,1147 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class HttpAuthentication(msrest.serialization.Model): - """HttpAuthentication. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OAuthAuthentication, BasicAuthentication, ClientCertAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. - Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'ActiveDirectoryOAuth': 'OAuthAuthentication', 'Basic': 'BasicAuthentication', 'ClientCertificate': 'ClientCertAuthentication'} - } - - def __init__( - self, - **kwargs - ): - super(HttpAuthentication, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class BasicAuthentication(HttpAuthentication): - """BasicAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. - Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param username: Gets or sets the username. - :type username: str - :param password: Gets or sets the password, return value will always be empty. - :type password: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BasicAuthentication, self).__init__(**kwargs) - self.type = 'Basic' # type: str - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class ClientCertAuthentication(HttpAuthentication): - """ClientCertAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. - Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param password: Gets or sets the certificate password, return value will always be empty. - :type password: str - :param pfx: Gets or sets the pfx certificate. Accepts certification in base64 encoding, return - value will always be empty. - :type pfx: str - :param certificate_thumbprint: Gets or sets the certificate thumbprint. - :type certificate_thumbprint: str - :param certificate_expiration_date: Gets or sets the certificate expiration date. - :type certificate_expiration_date: ~datetime.datetime - :param certificate_subject_name: Gets or sets the certificate subject name. - :type certificate_subject_name: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'pfx': {'key': 'pfx', 'type': 'str'}, - 'certificate_thumbprint': {'key': 'certificateThumbprint', 'type': 'str'}, - 'certificate_expiration_date': {'key': 'certificateExpirationDate', 'type': 'iso-8601'}, - 'certificate_subject_name': {'key': 'certificateSubjectName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientCertAuthentication, self).__init__(**kwargs) - self.type = 'ClientCertificate' # type: str - self.password = kwargs.get('password', None) - self.pfx = kwargs.get('pfx', None) - self.certificate_thumbprint = kwargs.get('certificate_thumbprint', None) - self.certificate_expiration_date = kwargs.get('certificate_expiration_date', None) - self.certificate_subject_name = kwargs.get('certificate_subject_name', None) - - -class HttpRequest(msrest.serialization.Model): - """HttpRequest. - - :param authentication: Gets or sets the authentication method of the request. - :type authentication: ~azure.mgmt.scheduler.models.HttpAuthentication - :param uri: Gets or sets the URI of the request. - :type uri: str - :param method: Gets or sets the method of the request. - :type method: str - :param body: Gets or sets the request body. - :type body: str - :param headers: Gets or sets the headers. - :type headers: dict[str, str] - """ - - _attribute_map = { - 'authentication': {'key': 'authentication', 'type': 'HttpAuthentication'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'body': {'key': 'body', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(HttpRequest, self).__init__(**kwargs) - self.authentication = kwargs.get('authentication', None) - self.uri = kwargs.get('uri', None) - self.method = kwargs.get('method', None) - self.body = kwargs.get('body', None) - self.headers = kwargs.get('headers', None) - - -class JobAction(msrest.serialization.Model): - """JobAction. - - :param type: Gets or sets the job action type. Possible values include: "Http", "Https", - "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". - :type type: str or ~azure.mgmt.scheduler.models.JobActionType - :param request: Gets or sets the http requests. - :type request: ~azure.mgmt.scheduler.models.HttpRequest - :param queue_message: Gets or sets the storage queue message. - :type queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage - :param service_bus_queue_message: Gets or sets the service bus queue message. - :type service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage - :param service_bus_topic_message: Gets or sets the service bus topic message. - :type service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage - :param retry_policy: Gets or sets the retry policy. - :type retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy - :param error_action: Gets or sets the error action. - :type error_action: ~azure.mgmt.scheduler.models.JobErrorAction - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'request': {'key': 'request', 'type': 'HttpRequest'}, - 'queue_message': {'key': 'queueMessage', 'type': 'StorageQueueMessage'}, - 'service_bus_queue_message': {'key': 'serviceBusQueueMessage', 'type': 'ServiceBusQueueMessage'}, - 'service_bus_topic_message': {'key': 'serviceBusTopicMessage', 'type': 'ServiceBusTopicMessage'}, - 'retry_policy': {'key': 'retryPolicy', 'type': 'RetryPolicy'}, - 'error_action': {'key': 'errorAction', 'type': 'JobErrorAction'}, - } - - def __init__( - self, - **kwargs - ): - super(JobAction, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.request = kwargs.get('request', None) - self.queue_message = kwargs.get('queue_message', None) - self.service_bus_queue_message = kwargs.get('service_bus_queue_message', None) - self.service_bus_topic_message = kwargs.get('service_bus_topic_message', None) - self.retry_policy = kwargs.get('retry_policy', None) - self.error_action = kwargs.get('error_action', None) - - -class JobCollectionDefinition(msrest.serialization.Model): - """JobCollectionDefinition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the job collection resource identifier. - :vartype id: str - :ivar type: Gets the job collection resource type. - :vartype type: str - :param name: Gets or sets the job collection resource name. - :type name: str - :param location: Gets or sets the storage account location. - :type location: str - :param tags: A set of tags. Gets or sets the tags. - :type tags: dict[str, str] - :param properties: Gets or sets the job collection properties. - :type properties: ~azure.mgmt.scheduler.models.JobCollectionProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'JobCollectionProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollectionDefinition, self).__init__(**kwargs) - self.id = None - self.type = None - self.name = kwargs.get('name', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class JobCollectionListResult(msrest.serialization.Model): - """JobCollectionListResult. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the job collections. - :vartype value: list[~azure.mgmt.scheduler.models.JobCollectionDefinition] - :param next_link: Gets or sets the URL to get the next set of job collections. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[JobCollectionDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollectionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class JobCollectionProperties(msrest.serialization.Model): - """JobCollectionProperties. - - :param sku: Gets or sets the SKU. - :type sku: ~azure.mgmt.scheduler.models.Sku - :param state: Gets or sets the state. Possible values include: "Enabled", "Disabled", - "Suspended", "Deleted". - :type state: str or ~azure.mgmt.scheduler.models.JobCollectionState - :param quota: Gets or sets the job collection quota. - :type quota: ~azure.mgmt.scheduler.models.JobCollectionQuota - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'state': {'key': 'state', 'type': 'str'}, - 'quota': {'key': 'quota', 'type': 'JobCollectionQuota'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollectionProperties, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.state = kwargs.get('state', None) - self.quota = kwargs.get('quota', None) - - -class JobCollectionQuota(msrest.serialization.Model): - """JobCollectionQuota. - - :param max_job_count: Gets or set the maximum job count. - :type max_job_count: int - :param max_job_occurrence: Gets or sets the maximum job occurrence. - :type max_job_occurrence: int - :param max_recurrence: Gets or set the maximum recurrence. - :type max_recurrence: ~azure.mgmt.scheduler.models.JobMaxRecurrence - """ - - _attribute_map = { - 'max_job_count': {'key': 'maxJobCount', 'type': 'int'}, - 'max_job_occurrence': {'key': 'maxJobOccurrence', 'type': 'int'}, - 'max_recurrence': {'key': 'maxRecurrence', 'type': 'JobMaxRecurrence'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollectionQuota, self).__init__(**kwargs) - self.max_job_count = kwargs.get('max_job_count', None) - self.max_job_occurrence = kwargs.get('max_job_occurrence', None) - self.max_recurrence = kwargs.get('max_recurrence', None) - - -class JobDefinition(msrest.serialization.Model): - """JobDefinition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the job resource identifier. - :vartype id: str - :ivar type: Gets the job resource type. - :vartype type: str - :ivar name: Gets the job resource name. - :vartype name: str - :param properties: Gets or sets the job properties. - :type properties: ~azure.mgmt.scheduler.models.JobProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'JobProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(JobDefinition, self).__init__(**kwargs) - self.id = None - self.type = None - self.name = None - self.properties = kwargs.get('properties', None) - - -class JobErrorAction(msrest.serialization.Model): - """JobErrorAction. - - :param type: Gets or sets the job error action type. Possible values include: "Http", "Https", - "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". - :type type: str or ~azure.mgmt.scheduler.models.JobActionType - :param request: Gets or sets the http requests. - :type request: ~azure.mgmt.scheduler.models.HttpRequest - :param queue_message: Gets or sets the storage queue message. - :type queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage - :param service_bus_queue_message: Gets or sets the service bus queue message. - :type service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage - :param service_bus_topic_message: Gets or sets the service bus topic message. - :type service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage - :param retry_policy: Gets or sets the retry policy. - :type retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'request': {'key': 'request', 'type': 'HttpRequest'}, - 'queue_message': {'key': 'queueMessage', 'type': 'StorageQueueMessage'}, - 'service_bus_queue_message': {'key': 'serviceBusQueueMessage', 'type': 'ServiceBusQueueMessage'}, - 'service_bus_topic_message': {'key': 'serviceBusTopicMessage', 'type': 'ServiceBusTopicMessage'}, - 'retry_policy': {'key': 'retryPolicy', 'type': 'RetryPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorAction, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.request = kwargs.get('request', None) - self.queue_message = kwargs.get('queue_message', None) - self.service_bus_queue_message = kwargs.get('service_bus_queue_message', None) - self.service_bus_topic_message = kwargs.get('service_bus_topic_message', None) - self.retry_policy = kwargs.get('retry_policy', None) - - -class JobHistoryDefinition(msrest.serialization.Model): - """JobHistoryDefinition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the job history identifier. - :vartype id: str - :ivar type: Gets the job history resource type. - :vartype type: str - :ivar name: Gets the job history name. - :vartype name: str - :ivar properties: Gets or sets the job history properties. - :vartype properties: ~azure.mgmt.scheduler.models.JobHistoryDefinitionProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'name': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'JobHistoryDefinitionProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(JobHistoryDefinition, self).__init__(**kwargs) - self.id = None - self.type = None - self.name = None - self.properties = None - - -class JobHistoryDefinitionProperties(msrest.serialization.Model): - """JobHistoryDefinitionProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: Gets the start time for this job. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets the end time for this job. - :vartype end_time: ~datetime.datetime - :ivar expected_execution_time: Gets the expected execution time for this job. - :vartype expected_execution_time: ~datetime.datetime - :ivar action_name: Gets the job history action name. Possible values include: "MainAction", - "ErrorAction". - :vartype action_name: str or ~azure.mgmt.scheduler.models.JobHistoryActionName - :ivar status: Gets the job history status. Possible values include: "Completed", "Failed", - "Postponed". - :vartype status: str or ~azure.mgmt.scheduler.models.JobExecutionStatus - :ivar message: Gets the message for the job history. - :vartype message: str - :ivar retry_count: Gets the retry count for job. - :vartype retry_count: int - :ivar repeat_count: Gets the repeat count for the job. - :vartype repeat_count: int - """ - - _validation = { - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'expected_execution_time': {'readonly': True}, - 'action_name': {'readonly': True}, - 'status': {'readonly': True}, - 'message': {'readonly': True}, - 'retry_count': {'readonly': True}, - 'repeat_count': {'readonly': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'expected_execution_time': {'key': 'expectedExecutionTime', 'type': 'iso-8601'}, - 'action_name': {'key': 'actionName', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'retry_count': {'key': 'retryCount', 'type': 'int'}, - 'repeat_count': {'key': 'repeatCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JobHistoryDefinitionProperties, self).__init__(**kwargs) - self.start_time = None - self.end_time = None - self.expected_execution_time = None - self.action_name = None - self.status = None - self.message = None - self.retry_count = None - self.repeat_count = None - - -class JobHistoryFilter(msrest.serialization.Model): - """JobHistoryFilter. - - :param status: Gets or sets the job execution status. Possible values include: "Completed", - "Failed", "Postponed". - :type status: str or ~azure.mgmt.scheduler.models.JobExecutionStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobHistoryFilter, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class JobHistoryListResult(msrest.serialization.Model): - """JobHistoryListResult. - - :param value: Gets or sets the job histories under job. - :type value: list[~azure.mgmt.scheduler.models.JobHistoryDefinition] - :param next_link: Gets or sets the URL to get the next set of job histories. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[JobHistoryDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobHistoryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class JobListResult(msrest.serialization.Model): - """JobListResult. - - :param value: Gets or sets all jobs under job collection. - :type value: list[~azure.mgmt.scheduler.models.JobDefinition] - :param next_link: Gets or sets the URL to get the next set of jobs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[JobDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class JobMaxRecurrence(msrest.serialization.Model): - """JobMaxRecurrence. - - :param frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, - month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". - :type frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency - :param interval: Gets or sets the interval between retries. - :type interval: int - """ - - _attribute_map = { - 'frequency': {'key': 'frequency', 'type': 'str'}, - 'interval': {'key': 'interval', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JobMaxRecurrence, self).__init__(**kwargs) - self.frequency = kwargs.get('frequency', None) - self.interval = kwargs.get('interval', None) - - -class JobProperties(msrest.serialization.Model): - """JobProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param start_time: Gets or sets the job start time. - :type start_time: ~datetime.datetime - :param action: Gets or sets the job action. - :type action: ~azure.mgmt.scheduler.models.JobAction - :param recurrence: Gets or sets the job recurrence. - :type recurrence: ~azure.mgmt.scheduler.models.JobRecurrence - :param state: Gets or set the job state. Possible values include: "Enabled", "Disabled", - "Faulted", "Completed". - :type state: str or ~azure.mgmt.scheduler.models.JobState - :ivar status: Gets the job status. - :vartype status: ~azure.mgmt.scheduler.models.JobStatus - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'JobAction'}, - 'recurrence': {'key': 'recurrence', 'type': 'JobRecurrence'}, - 'state': {'key': 'state', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'JobStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(JobProperties, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.action = kwargs.get('action', None) - self.recurrence = kwargs.get('recurrence', None) - self.state = kwargs.get('state', None) - self.status = None - - -class JobRecurrence(msrest.serialization.Model): - """JobRecurrence. - - :param frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, - month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". - :type frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency - :param interval: Gets or sets the interval between retries. - :type interval: int - :param count: Gets or sets the maximum number of times that the job should run. - :type count: int - :param end_time: Gets or sets the time at which the job will complete. - :type end_time: ~datetime.datetime - :param schedule: - :type schedule: ~azure.mgmt.scheduler.models.JobRecurrenceSchedule - """ - - _attribute_map = { - 'frequency': {'key': 'frequency', 'type': 'str'}, - 'interval': {'key': 'interval', 'type': 'int'}, - 'count': {'key': 'count', 'type': 'int'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'JobRecurrenceSchedule'}, - } - - def __init__( - self, - **kwargs - ): - super(JobRecurrence, self).__init__(**kwargs) - self.frequency = kwargs.get('frequency', None) - self.interval = kwargs.get('interval', None) - self.count = kwargs.get('count', None) - self.end_time = kwargs.get('end_time', None) - self.schedule = kwargs.get('schedule', None) - - -class JobRecurrenceSchedule(msrest.serialization.Model): - """JobRecurrenceSchedule. - - :param week_days: Gets or sets the days of the week that the job should execute on. - :type week_days: list[str or ~azure.mgmt.scheduler.models.DayOfWeek] - :param hours: Gets or sets the hours of the day that the job should execute at. - :type hours: list[int] - :param minutes: Gets or sets the minutes of the hour that the job should execute at. - :type minutes: list[int] - :param month_days: Gets or sets the days of the month that the job should execute on. Must be - between 1 and 31. - :type month_days: list[int] - :param monthly_occurrences: Gets or sets the occurrences of days within a month. - :type monthly_occurrences: - list[~azure.mgmt.scheduler.models.JobRecurrenceScheduleMonthlyOccurrence] - """ - - _attribute_map = { - 'week_days': {'key': 'weekDays', 'type': '[str]'}, - 'hours': {'key': 'hours', 'type': '[int]'}, - 'minutes': {'key': 'minutes', 'type': '[int]'}, - 'month_days': {'key': 'monthDays', 'type': '[int]'}, - 'monthly_occurrences': {'key': 'monthlyOccurrences', 'type': '[JobRecurrenceScheduleMonthlyOccurrence]'}, - } - - def __init__( - self, - **kwargs - ): - super(JobRecurrenceSchedule, self).__init__(**kwargs) - self.week_days = kwargs.get('week_days', None) - self.hours = kwargs.get('hours', None) - self.minutes = kwargs.get('minutes', None) - self.month_days = kwargs.get('month_days', None) - self.monthly_occurrences = kwargs.get('monthly_occurrences', None) - - -class JobRecurrenceScheduleMonthlyOccurrence(msrest.serialization.Model): - """JobRecurrenceScheduleMonthlyOccurrence. - - :param day: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, - saturday, sunday. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", - "Friday", "Saturday", "Sunday". - :type day: str or ~azure.mgmt.scheduler.models.JobScheduleDay - :param occurrence: Gets or sets the occurrence. Must be between -5 and 5. - :type occurrence: int - """ - - _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'occurrence': {'key': 'Occurrence', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JobRecurrenceScheduleMonthlyOccurrence, self).__init__(**kwargs) - self.day = kwargs.get('day', None) - self.occurrence = kwargs.get('occurrence', None) - - -class JobStateFilter(msrest.serialization.Model): - """JobStateFilter. - - :param state: Gets or sets the job state. Possible values include: "Enabled", "Disabled", - "Faulted", "Completed". - :type state: str or ~azure.mgmt.scheduler.models.JobState - """ - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobStateFilter, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - - -class JobStatus(msrest.serialization.Model): - """JobStatus. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar execution_count: Gets the number of times this job has executed. - :vartype execution_count: int - :ivar failure_count: Gets the number of times this job has failed. - :vartype failure_count: int - :ivar faulted_count: Gets the number of faulted occurrences (occurrences that were retried and - failed as many times as the retry policy states). - :vartype faulted_count: int - :ivar last_execution_time: Gets the time the last occurrence executed in ISO-8601 format. - Could be empty if job has not run yet. - :vartype last_execution_time: ~datetime.datetime - :ivar next_execution_time: Gets the time of the next occurrence in ISO-8601 format. Could be - empty if the job is completed. - :vartype next_execution_time: ~datetime.datetime - """ - - _validation = { - 'execution_count': {'readonly': True}, - 'failure_count': {'readonly': True}, - 'faulted_count': {'readonly': True}, - 'last_execution_time': {'readonly': True}, - 'next_execution_time': {'readonly': True}, - } - - _attribute_map = { - 'execution_count': {'key': 'executionCount', 'type': 'int'}, - 'failure_count': {'key': 'failureCount', 'type': 'int'}, - 'faulted_count': {'key': 'faultedCount', 'type': 'int'}, - 'last_execution_time': {'key': 'lastExecutionTime', 'type': 'iso-8601'}, - 'next_execution_time': {'key': 'nextExecutionTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(JobStatus, self).__init__(**kwargs) - self.execution_count = None - self.failure_count = None - self.faulted_count = None - self.last_execution_time = None - self.next_execution_time = None - - -class OAuthAuthentication(HttpAuthentication): - """OAuthAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. - Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param secret: Gets or sets the secret, return value will always be empty. - :type secret: str - :param tenant: Gets or sets the tenant. - :type tenant: str - :param audience: Gets or sets the audience. - :type audience: str - :param client_id: Gets or sets the client identifier. - :type client_id: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'tenant': {'key': 'tenant', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OAuthAuthentication, self).__init__(**kwargs) - self.type = 'ActiveDirectoryOAuth' # type: str - self.secret = kwargs.get('secret', None) - self.tenant = kwargs.get('tenant', None) - self.audience = kwargs.get('audience', None) - self.client_id = kwargs.get('client_id', None) - - -class RetryPolicy(msrest.serialization.Model): - """RetryPolicy. - - :param retry_type: Gets or sets the retry strategy to be used. Possible values include: "None", - "Fixed". - :type retry_type: str or ~azure.mgmt.scheduler.models.RetryType - :param retry_interval: Gets or sets the retry interval between retries, specify duration in ISO - 8601 format. - :type retry_interval: ~datetime.timedelta - :param retry_count: Gets or sets the number of times a retry should be attempted. - :type retry_count: int - """ - - _attribute_map = { - 'retry_type': {'key': 'retryType', 'type': 'str'}, - 'retry_interval': {'key': 'retryInterval', 'type': 'duration'}, - 'retry_count': {'key': 'retryCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RetryPolicy, self).__init__(**kwargs) - self.retry_type = kwargs.get('retry_type', None) - self.retry_interval = kwargs.get('retry_interval', None) - self.retry_count = kwargs.get('retry_count', None) - - -class ServiceBusAuthentication(msrest.serialization.Model): - """ServiceBusAuthentication. - - :param sas_key: Gets or sets the SAS key. - :type sas_key: str - :param sas_key_name: Gets or sets the SAS key name. - :type sas_key_name: str - :param type: Gets or sets the authentication type. Possible values include: "NotSpecified", - "SharedAccessKey". - :type type: str or ~azure.mgmt.scheduler.models.ServiceBusAuthenticationType - """ - - _attribute_map = { - 'sas_key': {'key': 'sasKey', 'type': 'str'}, - 'sas_key_name': {'key': 'sasKeyName', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceBusAuthentication, self).__init__(**kwargs) - self.sas_key = kwargs.get('sas_key', None) - self.sas_key_name = kwargs.get('sas_key_name', None) - self.type = kwargs.get('type', None) - - -class ServiceBusBrokeredMessageProperties(msrest.serialization.Model): - """ServiceBusBrokeredMessageProperties. - - :param content_type: Gets or sets the content type. - :type content_type: str - :param correlation_id: Gets or sets the correlation ID. - :type correlation_id: str - :param force_persistence: Gets or sets the force persistence. - :type force_persistence: bool - :param label: Gets or sets the label. - :type label: str - :param message_id: Gets or sets the message ID. - :type message_id: str - :param partition_key: Gets or sets the partition key. - :type partition_key: str - :param reply_to: Gets or sets the reply to. - :type reply_to: str - :param reply_to_session_id: Gets or sets the reply to session ID. - :type reply_to_session_id: str - :param scheduled_enqueue_time_utc: Gets or sets the scheduled enqueue time UTC. - :type scheduled_enqueue_time_utc: ~datetime.datetime - :param session_id: Gets or sets the session ID. - :type session_id: str - :param time_to_live: Gets or sets the time to live. - :type time_to_live: ~datetime.timedelta - :param to: Gets or sets the to. - :type to: str - :param via_partition_key: Gets or sets the via partition key. - :type via_partition_key: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'force_persistence': {'key': 'forcePersistence', 'type': 'bool'}, - 'label': {'key': 'label', 'type': 'str'}, - 'message_id': {'key': 'messageId', 'type': 'str'}, - 'partition_key': {'key': 'partitionKey', 'type': 'str'}, - 'reply_to': {'key': 'replyTo', 'type': 'str'}, - 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, - 'scheduled_enqueue_time_utc': {'key': 'scheduledEnqueueTimeUtc', 'type': 'iso-8601'}, - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'time_to_live': {'key': 'timeToLive', 'type': 'duration'}, - 'to': {'key': 'to', 'type': 'str'}, - 'via_partition_key': {'key': 'viaPartitionKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceBusBrokeredMessageProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - self.correlation_id = kwargs.get('correlation_id', None) - self.force_persistence = kwargs.get('force_persistence', None) - self.label = kwargs.get('label', None) - self.message_id = kwargs.get('message_id', None) - self.partition_key = kwargs.get('partition_key', None) - self.reply_to = kwargs.get('reply_to', None) - self.reply_to_session_id = kwargs.get('reply_to_session_id', None) - self.scheduled_enqueue_time_utc = kwargs.get('scheduled_enqueue_time_utc', None) - self.session_id = kwargs.get('session_id', None) - self.time_to_live = kwargs.get('time_to_live', None) - self.to = kwargs.get('to', None) - self.via_partition_key = kwargs.get('via_partition_key', None) - - -class ServiceBusMessage(msrest.serialization.Model): - """ServiceBusMessage. - - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: - ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType - """ - - _attribute_map = { - 'authentication': {'key': 'authentication', 'type': 'ServiceBusAuthentication'}, - 'brokered_message_properties': {'key': 'brokeredMessageProperties', 'type': 'ServiceBusBrokeredMessageProperties'}, - 'custom_message_properties': {'key': 'customMessageProperties', 'type': '{str}'}, - 'message': {'key': 'message', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'transport_type': {'key': 'transportType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceBusMessage, self).__init__(**kwargs) - self.authentication = kwargs.get('authentication', None) - self.brokered_message_properties = kwargs.get('brokered_message_properties', None) - self.custom_message_properties = kwargs.get('custom_message_properties', None) - self.message = kwargs.get('message', None) - self.namespace = kwargs.get('namespace', None) - self.transport_type = kwargs.get('transport_type', None) - - -class ServiceBusQueueMessage(ServiceBusMessage): - """ServiceBusQueueMessage. - - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: - ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType - :param queue_name: Gets or sets the queue name. - :type queue_name: str - """ - - _attribute_map = { - 'authentication': {'key': 'authentication', 'type': 'ServiceBusAuthentication'}, - 'brokered_message_properties': {'key': 'brokeredMessageProperties', 'type': 'ServiceBusBrokeredMessageProperties'}, - 'custom_message_properties': {'key': 'customMessageProperties', 'type': '{str}'}, - 'message': {'key': 'message', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'transport_type': {'key': 'transportType', 'type': 'str'}, - 'queue_name': {'key': 'queueName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceBusQueueMessage, self).__init__(**kwargs) - self.queue_name = kwargs.get('queue_name', None) - - -class ServiceBusTopicMessage(ServiceBusMessage): - """ServiceBusTopicMessage. - - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: - ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType - :param topic_path: Gets or sets the topic path. - :type topic_path: str - """ - - _attribute_map = { - 'authentication': {'key': 'authentication', 'type': 'ServiceBusAuthentication'}, - 'brokered_message_properties': {'key': 'brokeredMessageProperties', 'type': 'ServiceBusBrokeredMessageProperties'}, - 'custom_message_properties': {'key': 'customMessageProperties', 'type': '{str}'}, - 'message': {'key': 'message', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'transport_type': {'key': 'transportType', 'type': 'str'}, - 'topic_path': {'key': 'topicPath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceBusTopicMessage, self).__init__(**kwargs) - self.topic_path = kwargs.get('topic_path', None) - - -class Sku(msrest.serialization.Model): - """Sku. - - :param name: Gets or set the SKU. Possible values include: "Standard", "Free", "P10Premium", - "P20Premium". - :type name: str or ~azure.mgmt.scheduler.models.SkuDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class StorageQueueMessage(msrest.serialization.Model): - """StorageQueueMessage. - - :param storage_account: Gets or sets the storage account name. - :type storage_account: str - :param queue_name: Gets or sets the queue name. - :type queue_name: str - :param sas_token: Gets or sets the SAS key. - :type sas_token: str - :param message: Gets or sets the message. - :type message: str - """ - - _attribute_map = { - 'storage_account': {'key': 'storageAccount', 'type': 'str'}, - 'queue_name': {'key': 'queueName', 'type': 'str'}, - 'sas_token': {'key': 'sasToken', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueueMessage, self).__init__(**kwargs) - self.storage_account = kwargs.get('storage_account', None) - self.queue_name = kwargs.get('queue_name', None) - self.sas_token = kwargs.get('sas_token', None) - self.message = kwargs.get('message', None) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py index 1defb7ebba39..c96f10910b7b 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py @@ -22,9 +22,9 @@ class HttpAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. + :ivar type: Required. Gets or sets the HTTP authentication type.Constant filled by server. Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType + :vartype type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType """ _validation = { @@ -43,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(HttpAuthentication, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -52,13 +54,13 @@ class BasicAuthentication(HttpAuthentication): All required parameters must be populated in order to send to Azure. - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. + :ivar type: Required. Gets or sets the HTTP authentication type.Constant filled by server. Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param username: Gets or sets the username. - :type username: str - :param password: Gets or sets the password, return value will always be empty. - :type password: str + :vartype type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType + :ivar username: Gets or sets the username. + :vartype username: str + :ivar password: Gets or sets the password, return value will always be empty. + :vartype password: str """ _validation = { @@ -78,6 +80,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: Gets or sets the username. + :paramtype username: str + :keyword password: Gets or sets the password, return value will always be empty. + :paramtype password: str + """ super(BasicAuthentication, self).__init__(**kwargs) self.type = 'Basic' # type: str self.username = username @@ -89,20 +97,20 @@ class ClientCertAuthentication(HttpAuthentication): All required parameters must be populated in order to send to Azure. - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. + :ivar type: Required. Gets or sets the HTTP authentication type.Constant filled by server. Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param password: Gets or sets the certificate password, return value will always be empty. - :type password: str - :param pfx: Gets or sets the pfx certificate. Accepts certification in base64 encoding, return + :vartype type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType + :ivar password: Gets or sets the certificate password, return value will always be empty. + :vartype password: str + :ivar pfx: Gets or sets the pfx certificate. Accepts certification in base64 encoding, return value will always be empty. - :type pfx: str - :param certificate_thumbprint: Gets or sets the certificate thumbprint. - :type certificate_thumbprint: str - :param certificate_expiration_date: Gets or sets the certificate expiration date. - :type certificate_expiration_date: ~datetime.datetime - :param certificate_subject_name: Gets or sets the certificate subject name. - :type certificate_subject_name: str + :vartype pfx: str + :ivar certificate_thumbprint: Gets or sets the certificate thumbprint. + :vartype certificate_thumbprint: str + :ivar certificate_expiration_date: Gets or sets the certificate expiration date. + :vartype certificate_expiration_date: ~datetime.datetime + :ivar certificate_subject_name: Gets or sets the certificate subject name. + :vartype certificate_subject_name: str """ _validation = { @@ -128,6 +136,19 @@ def __init__( certificate_subject_name: Optional[str] = None, **kwargs ): + """ + :keyword password: Gets or sets the certificate password, return value will always be empty. + :paramtype password: str + :keyword pfx: Gets or sets the pfx certificate. Accepts certification in base64 encoding, + return value will always be empty. + :paramtype pfx: str + :keyword certificate_thumbprint: Gets or sets the certificate thumbprint. + :paramtype certificate_thumbprint: str + :keyword certificate_expiration_date: Gets or sets the certificate expiration date. + :paramtype certificate_expiration_date: ~datetime.datetime + :keyword certificate_subject_name: Gets or sets the certificate subject name. + :paramtype certificate_subject_name: str + """ super(ClientCertAuthentication, self).__init__(**kwargs) self.type = 'ClientCertificate' # type: str self.password = password @@ -140,16 +161,16 @@ def __init__( class HttpRequest(msrest.serialization.Model): """HttpRequest. - :param authentication: Gets or sets the authentication method of the request. - :type authentication: ~azure.mgmt.scheduler.models.HttpAuthentication - :param uri: Gets or sets the URI of the request. - :type uri: str - :param method: Gets or sets the method of the request. - :type method: str - :param body: Gets or sets the request body. - :type body: str - :param headers: Gets or sets the headers. - :type headers: dict[str, str] + :ivar authentication: Gets or sets the authentication method of the request. + :vartype authentication: ~azure.mgmt.scheduler.models.HttpAuthentication + :ivar uri: Gets or sets the URI of the request. + :vartype uri: str + :ivar method: Gets or sets the method of the request. + :vartype method: str + :ivar body: Gets or sets the request body. + :vartype body: str + :ivar headers: Gets or sets the headers. + :vartype headers: dict[str, str] """ _attribute_map = { @@ -170,6 +191,18 @@ def __init__( headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword authentication: Gets or sets the authentication method of the request. + :paramtype authentication: ~azure.mgmt.scheduler.models.HttpAuthentication + :keyword uri: Gets or sets the URI of the request. + :paramtype uri: str + :keyword method: Gets or sets the method of the request. + :paramtype method: str + :keyword body: Gets or sets the request body. + :paramtype body: str + :keyword headers: Gets or sets the headers. + :paramtype headers: dict[str, str] + """ super(HttpRequest, self).__init__(**kwargs) self.authentication = authentication self.uri = uri @@ -181,21 +214,21 @@ def __init__( class JobAction(msrest.serialization.Model): """JobAction. - :param type: Gets or sets the job action type. Possible values include: "Http", "Https", + :ivar type: Gets or sets the job action type. Possible values include: "Http", "Https", "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". - :type type: str or ~azure.mgmt.scheduler.models.JobActionType - :param request: Gets or sets the http requests. - :type request: ~azure.mgmt.scheduler.models.HttpRequest - :param queue_message: Gets or sets the storage queue message. - :type queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage - :param service_bus_queue_message: Gets or sets the service bus queue message. - :type service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage - :param service_bus_topic_message: Gets or sets the service bus topic message. - :type service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage - :param retry_policy: Gets or sets the retry policy. - :type retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy - :param error_action: Gets or sets the error action. - :type error_action: ~azure.mgmt.scheduler.models.JobErrorAction + :vartype type: str or ~azure.mgmt.scheduler.models.JobActionType + :ivar request: Gets or sets the http requests. + :vartype request: ~azure.mgmt.scheduler.models.HttpRequest + :ivar queue_message: Gets or sets the storage queue message. + :vartype queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage + :ivar service_bus_queue_message: Gets or sets the service bus queue message. + :vartype service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage + :ivar service_bus_topic_message: Gets or sets the service bus topic message. + :vartype service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage + :ivar retry_policy: Gets or sets the retry policy. + :vartype retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy + :ivar error_action: Gets or sets the error action. + :vartype error_action: ~azure.mgmt.scheduler.models.JobErrorAction """ _attribute_map = { @@ -220,6 +253,23 @@ def __init__( error_action: Optional["JobErrorAction"] = None, **kwargs ): + """ + :keyword type: Gets or sets the job action type. Possible values include: "Http", "Https", + "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". + :paramtype type: str or ~azure.mgmt.scheduler.models.JobActionType + :keyword request: Gets or sets the http requests. + :paramtype request: ~azure.mgmt.scheduler.models.HttpRequest + :keyword queue_message: Gets or sets the storage queue message. + :paramtype queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage + :keyword service_bus_queue_message: Gets or sets the service bus queue message. + :paramtype service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage + :keyword service_bus_topic_message: Gets or sets the service bus topic message. + :paramtype service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage + :keyword retry_policy: Gets or sets the retry policy. + :paramtype retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy + :keyword error_action: Gets or sets the error action. + :paramtype error_action: ~azure.mgmt.scheduler.models.JobErrorAction + """ super(JobAction, self).__init__(**kwargs) self.type = type self.request = request @@ -239,14 +289,14 @@ class JobCollectionDefinition(msrest.serialization.Model): :vartype id: str :ivar type: Gets the job collection resource type. :vartype type: str - :param name: Gets or sets the job collection resource name. - :type name: str - :param location: Gets or sets the storage account location. - :type location: str - :param tags: A set of tags. Gets or sets the tags. - :type tags: dict[str, str] - :param properties: Gets or sets the job collection properties. - :type properties: ~azure.mgmt.scheduler.models.JobCollectionProperties + :ivar name: Gets or sets the job collection resource name. + :vartype name: str + :ivar location: Gets or sets the storage account location. + :vartype location: str + :ivar tags: A set of tags. Gets or sets the tags. + :vartype tags: dict[str, str] + :ivar properties: Gets or sets the job collection properties. + :vartype properties: ~azure.mgmt.scheduler.models.JobCollectionProperties """ _validation = { @@ -272,6 +322,16 @@ def __init__( properties: Optional["JobCollectionProperties"] = None, **kwargs ): + """ + :keyword name: Gets or sets the job collection resource name. + :paramtype name: str + :keyword location: Gets or sets the storage account location. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets the tags. + :paramtype tags: dict[str, str] + :keyword properties: Gets or sets the job collection properties. + :paramtype properties: ~azure.mgmt.scheduler.models.JobCollectionProperties + """ super(JobCollectionDefinition, self).__init__(**kwargs) self.id = None self.type = None @@ -288,8 +348,8 @@ class JobCollectionListResult(msrest.serialization.Model): :ivar value: Gets the job collections. :vartype value: list[~azure.mgmt.scheduler.models.JobCollectionDefinition] - :param next_link: Gets or sets the URL to get the next set of job collections. - :type next_link: str + :ivar next_link: Gets or sets the URL to get the next set of job collections. + :vartype next_link: str """ _validation = { @@ -307,6 +367,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: Gets or sets the URL to get the next set of job collections. + :paramtype next_link: str + """ super(JobCollectionListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -315,13 +379,13 @@ def __init__( class JobCollectionProperties(msrest.serialization.Model): """JobCollectionProperties. - :param sku: Gets or sets the SKU. - :type sku: ~azure.mgmt.scheduler.models.Sku - :param state: Gets or sets the state. Possible values include: "Enabled", "Disabled", + :ivar sku: Gets or sets the SKU. + :vartype sku: ~azure.mgmt.scheduler.models.Sku + :ivar state: Gets or sets the state. Possible values include: "Enabled", "Disabled", "Suspended", "Deleted". - :type state: str or ~azure.mgmt.scheduler.models.JobCollectionState - :param quota: Gets or sets the job collection quota. - :type quota: ~azure.mgmt.scheduler.models.JobCollectionQuota + :vartype state: str or ~azure.mgmt.scheduler.models.JobCollectionState + :ivar quota: Gets or sets the job collection quota. + :vartype quota: ~azure.mgmt.scheduler.models.JobCollectionQuota """ _attribute_map = { @@ -338,6 +402,15 @@ def __init__( quota: Optional["JobCollectionQuota"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU. + :paramtype sku: ~azure.mgmt.scheduler.models.Sku + :keyword state: Gets or sets the state. Possible values include: "Enabled", "Disabled", + "Suspended", "Deleted". + :paramtype state: str or ~azure.mgmt.scheduler.models.JobCollectionState + :keyword quota: Gets or sets the job collection quota. + :paramtype quota: ~azure.mgmt.scheduler.models.JobCollectionQuota + """ super(JobCollectionProperties, self).__init__(**kwargs) self.sku = sku self.state = state @@ -347,12 +420,12 @@ def __init__( class JobCollectionQuota(msrest.serialization.Model): """JobCollectionQuota. - :param max_job_count: Gets or set the maximum job count. - :type max_job_count: int - :param max_job_occurrence: Gets or sets the maximum job occurrence. - :type max_job_occurrence: int - :param max_recurrence: Gets or set the maximum recurrence. - :type max_recurrence: ~azure.mgmt.scheduler.models.JobMaxRecurrence + :ivar max_job_count: Gets or set the maximum job count. + :vartype max_job_count: int + :ivar max_job_occurrence: Gets or sets the maximum job occurrence. + :vartype max_job_occurrence: int + :ivar max_recurrence: Gets or set the maximum recurrence. + :vartype max_recurrence: ~azure.mgmt.scheduler.models.JobMaxRecurrence """ _attribute_map = { @@ -369,6 +442,14 @@ def __init__( max_recurrence: Optional["JobMaxRecurrence"] = None, **kwargs ): + """ + :keyword max_job_count: Gets or set the maximum job count. + :paramtype max_job_count: int + :keyword max_job_occurrence: Gets or sets the maximum job occurrence. + :paramtype max_job_occurrence: int + :keyword max_recurrence: Gets or set the maximum recurrence. + :paramtype max_recurrence: ~azure.mgmt.scheduler.models.JobMaxRecurrence + """ super(JobCollectionQuota, self).__init__(**kwargs) self.max_job_count = max_job_count self.max_job_occurrence = max_job_occurrence @@ -386,8 +467,8 @@ class JobDefinition(msrest.serialization.Model): :vartype type: str :ivar name: Gets the job resource name. :vartype name: str - :param properties: Gets or sets the job properties. - :type properties: ~azure.mgmt.scheduler.models.JobProperties + :ivar properties: Gets or sets the job properties. + :vartype properties: ~azure.mgmt.scheduler.models.JobProperties """ _validation = { @@ -409,6 +490,10 @@ def __init__( properties: Optional["JobProperties"] = None, **kwargs ): + """ + :keyword properties: Gets or sets the job properties. + :paramtype properties: ~azure.mgmt.scheduler.models.JobProperties + """ super(JobDefinition, self).__init__(**kwargs) self.id = None self.type = None @@ -419,19 +504,19 @@ def __init__( class JobErrorAction(msrest.serialization.Model): """JobErrorAction. - :param type: Gets or sets the job error action type. Possible values include: "Http", "Https", + :ivar type: Gets or sets the job error action type. Possible values include: "Http", "Https", "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". - :type type: str or ~azure.mgmt.scheduler.models.JobActionType - :param request: Gets or sets the http requests. - :type request: ~azure.mgmt.scheduler.models.HttpRequest - :param queue_message: Gets or sets the storage queue message. - :type queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage - :param service_bus_queue_message: Gets or sets the service bus queue message. - :type service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage - :param service_bus_topic_message: Gets or sets the service bus topic message. - :type service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage - :param retry_policy: Gets or sets the retry policy. - :type retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy + :vartype type: str or ~azure.mgmt.scheduler.models.JobActionType + :ivar request: Gets or sets the http requests. + :vartype request: ~azure.mgmt.scheduler.models.HttpRequest + :ivar queue_message: Gets or sets the storage queue message. + :vartype queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage + :ivar service_bus_queue_message: Gets or sets the service bus queue message. + :vartype service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage + :ivar service_bus_topic_message: Gets or sets the service bus topic message. + :vartype service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage + :ivar retry_policy: Gets or sets the retry policy. + :vartype retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy """ _attribute_map = { @@ -454,6 +539,21 @@ def __init__( retry_policy: Optional["RetryPolicy"] = None, **kwargs ): + """ + :keyword type: Gets or sets the job error action type. Possible values include: "Http", + "Https", "StorageQueue", "ServiceBusQueue", "ServiceBusTopic". + :paramtype type: str or ~azure.mgmt.scheduler.models.JobActionType + :keyword request: Gets or sets the http requests. + :paramtype request: ~azure.mgmt.scheduler.models.HttpRequest + :keyword queue_message: Gets or sets the storage queue message. + :paramtype queue_message: ~azure.mgmt.scheduler.models.StorageQueueMessage + :keyword service_bus_queue_message: Gets or sets the service bus queue message. + :paramtype service_bus_queue_message: ~azure.mgmt.scheduler.models.ServiceBusQueueMessage + :keyword service_bus_topic_message: Gets or sets the service bus topic message. + :paramtype service_bus_topic_message: ~azure.mgmt.scheduler.models.ServiceBusTopicMessage + :keyword retry_policy: Gets or sets the retry policy. + :paramtype retry_policy: ~azure.mgmt.scheduler.models.RetryPolicy + """ super(JobErrorAction, self).__init__(**kwargs) self.type = type self.request = request @@ -496,6 +596,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobHistoryDefinition, self).__init__(**kwargs) self.id = None self.type = None @@ -554,6 +656,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobHistoryDefinitionProperties, self).__init__(**kwargs) self.start_time = None self.end_time = None @@ -568,9 +672,9 @@ def __init__( class JobHistoryFilter(msrest.serialization.Model): """JobHistoryFilter. - :param status: Gets or sets the job execution status. Possible values include: "Completed", + :ivar status: Gets or sets the job execution status. Possible values include: "Completed", "Failed", "Postponed". - :type status: str or ~azure.mgmt.scheduler.models.JobExecutionStatus + :vartype status: str or ~azure.mgmt.scheduler.models.JobExecutionStatus """ _attribute_map = { @@ -583,6 +687,11 @@ def __init__( status: Optional[Union[str, "JobExecutionStatus"]] = None, **kwargs ): + """ + :keyword status: Gets or sets the job execution status. Possible values include: "Completed", + "Failed", "Postponed". + :paramtype status: str or ~azure.mgmt.scheduler.models.JobExecutionStatus + """ super(JobHistoryFilter, self).__init__(**kwargs) self.status = status @@ -590,10 +699,10 @@ def __init__( class JobHistoryListResult(msrest.serialization.Model): """JobHistoryListResult. - :param value: Gets or sets the job histories under job. - :type value: list[~azure.mgmt.scheduler.models.JobHistoryDefinition] - :param next_link: Gets or sets the URL to get the next set of job histories. - :type next_link: str + :ivar value: Gets or sets the job histories under job. + :vartype value: list[~azure.mgmt.scheduler.models.JobHistoryDefinition] + :ivar next_link: Gets or sets the URL to get the next set of job histories. + :vartype next_link: str """ _attribute_map = { @@ -608,6 +717,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets or sets the job histories under job. + :paramtype value: list[~azure.mgmt.scheduler.models.JobHistoryDefinition] + :keyword next_link: Gets or sets the URL to get the next set of job histories. + :paramtype next_link: str + """ super(JobHistoryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -616,10 +731,10 @@ def __init__( class JobListResult(msrest.serialization.Model): """JobListResult. - :param value: Gets or sets all jobs under job collection. - :type value: list[~azure.mgmt.scheduler.models.JobDefinition] - :param next_link: Gets or sets the URL to get the next set of jobs. - :type next_link: str + :ivar value: Gets or sets all jobs under job collection. + :vartype value: list[~azure.mgmt.scheduler.models.JobDefinition] + :ivar next_link: Gets or sets the URL to get the next set of jobs. + :vartype next_link: str """ _attribute_map = { @@ -634,6 +749,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets or sets all jobs under job collection. + :paramtype value: list[~azure.mgmt.scheduler.models.JobDefinition] + :keyword next_link: Gets or sets the URL to get the next set of jobs. + :paramtype next_link: str + """ super(JobListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -642,11 +763,11 @@ def __init__( class JobMaxRecurrence(msrest.serialization.Model): """JobMaxRecurrence. - :param frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, + :ivar frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". - :type frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency - :param interval: Gets or sets the interval between retries. - :type interval: int + :vartype frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency + :ivar interval: Gets or sets the interval between retries. + :vartype interval: int """ _attribute_map = { @@ -661,6 +782,13 @@ def __init__( interval: Optional[int] = None, **kwargs ): + """ + :keyword frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, + month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". + :paramtype frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency + :keyword interval: Gets or sets the interval between retries. + :paramtype interval: int + """ super(JobMaxRecurrence, self).__init__(**kwargs) self.frequency = frequency self.interval = interval @@ -671,15 +799,15 @@ class JobProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param start_time: Gets or sets the job start time. - :type start_time: ~datetime.datetime - :param action: Gets or sets the job action. - :type action: ~azure.mgmt.scheduler.models.JobAction - :param recurrence: Gets or sets the job recurrence. - :type recurrence: ~azure.mgmt.scheduler.models.JobRecurrence - :param state: Gets or set the job state. Possible values include: "Enabled", "Disabled", + :ivar start_time: Gets or sets the job start time. + :vartype start_time: ~datetime.datetime + :ivar action: Gets or sets the job action. + :vartype action: ~azure.mgmt.scheduler.models.JobAction + :ivar recurrence: Gets or sets the job recurrence. + :vartype recurrence: ~azure.mgmt.scheduler.models.JobRecurrence + :ivar state: Gets or set the job state. Possible values include: "Enabled", "Disabled", "Faulted", "Completed". - :type state: str or ~azure.mgmt.scheduler.models.JobState + :vartype state: str or ~azure.mgmt.scheduler.models.JobState :ivar status: Gets the job status. :vartype status: ~azure.mgmt.scheduler.models.JobStatus """ @@ -705,6 +833,17 @@ def __init__( state: Optional[Union[str, "JobState"]] = None, **kwargs ): + """ + :keyword start_time: Gets or sets the job start time. + :paramtype start_time: ~datetime.datetime + :keyword action: Gets or sets the job action. + :paramtype action: ~azure.mgmt.scheduler.models.JobAction + :keyword recurrence: Gets or sets the job recurrence. + :paramtype recurrence: ~azure.mgmt.scheduler.models.JobRecurrence + :keyword state: Gets or set the job state. Possible values include: "Enabled", "Disabled", + "Faulted", "Completed". + :paramtype state: str or ~azure.mgmt.scheduler.models.JobState + """ super(JobProperties, self).__init__(**kwargs) self.start_time = start_time self.action = action @@ -716,17 +855,17 @@ def __init__( class JobRecurrence(msrest.serialization.Model): """JobRecurrence. - :param frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, + :ivar frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". - :type frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency - :param interval: Gets or sets the interval between retries. - :type interval: int - :param count: Gets or sets the maximum number of times that the job should run. - :type count: int - :param end_time: Gets or sets the time at which the job will complete. - :type end_time: ~datetime.datetime - :param schedule: - :type schedule: ~azure.mgmt.scheduler.models.JobRecurrenceSchedule + :vartype frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency + :ivar interval: Gets or sets the interval between retries. + :vartype interval: int + :ivar count: Gets or sets the maximum number of times that the job should run. + :vartype count: int + :ivar end_time: Gets or sets the time at which the job will complete. + :vartype end_time: ~datetime.datetime + :ivar schedule: + :vartype schedule: ~azure.mgmt.scheduler.models.JobRecurrenceSchedule """ _attribute_map = { @@ -747,6 +886,19 @@ def __init__( schedule: Optional["JobRecurrenceSchedule"] = None, **kwargs ): + """ + :keyword frequency: Gets or sets the frequency of recurrence (second, minute, hour, day, week, + month). Possible values include: "Minute", "Hour", "Day", "Week", "Month". + :paramtype frequency: str or ~azure.mgmt.scheduler.models.RecurrenceFrequency + :keyword interval: Gets or sets the interval between retries. + :paramtype interval: int + :keyword count: Gets or sets the maximum number of times that the job should run. + :paramtype count: int + :keyword end_time: Gets or sets the time at which the job will complete. + :paramtype end_time: ~datetime.datetime + :keyword schedule: + :paramtype schedule: ~azure.mgmt.scheduler.models.JobRecurrenceSchedule + """ super(JobRecurrence, self).__init__(**kwargs) self.frequency = frequency self.interval = interval @@ -758,17 +910,17 @@ def __init__( class JobRecurrenceSchedule(msrest.serialization.Model): """JobRecurrenceSchedule. - :param week_days: Gets or sets the days of the week that the job should execute on. - :type week_days: list[str or ~azure.mgmt.scheduler.models.DayOfWeek] - :param hours: Gets or sets the hours of the day that the job should execute at. - :type hours: list[int] - :param minutes: Gets or sets the minutes of the hour that the job should execute at. - :type minutes: list[int] - :param month_days: Gets or sets the days of the month that the job should execute on. Must be + :ivar week_days: Gets or sets the days of the week that the job should execute on. + :vartype week_days: list[str or ~azure.mgmt.scheduler.models.DayOfWeek] + :ivar hours: Gets or sets the hours of the day that the job should execute at. + :vartype hours: list[int] + :ivar minutes: Gets or sets the minutes of the hour that the job should execute at. + :vartype minutes: list[int] + :ivar month_days: Gets or sets the days of the month that the job should execute on. Must be between 1 and 31. - :type month_days: list[int] - :param monthly_occurrences: Gets or sets the occurrences of days within a month. - :type monthly_occurrences: + :vartype month_days: list[int] + :ivar monthly_occurrences: Gets or sets the occurrences of days within a month. + :vartype monthly_occurrences: list[~azure.mgmt.scheduler.models.JobRecurrenceScheduleMonthlyOccurrence] """ @@ -790,6 +942,20 @@ def __init__( monthly_occurrences: Optional[List["JobRecurrenceScheduleMonthlyOccurrence"]] = None, **kwargs ): + """ + :keyword week_days: Gets or sets the days of the week that the job should execute on. + :paramtype week_days: list[str or ~azure.mgmt.scheduler.models.DayOfWeek] + :keyword hours: Gets or sets the hours of the day that the job should execute at. + :paramtype hours: list[int] + :keyword minutes: Gets or sets the minutes of the hour that the job should execute at. + :paramtype minutes: list[int] + :keyword month_days: Gets or sets the days of the month that the job should execute on. Must be + between 1 and 31. + :paramtype month_days: list[int] + :keyword monthly_occurrences: Gets or sets the occurrences of days within a month. + :paramtype monthly_occurrences: + list[~azure.mgmt.scheduler.models.JobRecurrenceScheduleMonthlyOccurrence] + """ super(JobRecurrenceSchedule, self).__init__(**kwargs) self.week_days = week_days self.hours = hours @@ -801,12 +967,12 @@ def __init__( class JobRecurrenceScheduleMonthlyOccurrence(msrest.serialization.Model): """JobRecurrenceScheduleMonthlyOccurrence. - :param day: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, + :ivar day: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". - :type day: str or ~azure.mgmt.scheduler.models.JobScheduleDay - :param occurrence: Gets or sets the occurrence. Must be between -5 and 5. - :type occurrence: int + :vartype day: str or ~azure.mgmt.scheduler.models.JobScheduleDay + :ivar occurrence: Gets or sets the occurrence. Must be between -5 and 5. + :vartype occurrence: int """ _attribute_map = { @@ -821,6 +987,14 @@ def __init__( occurrence: Optional[int] = None, **kwargs ): + """ + :keyword day: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, + friday, saturday, sunday. Possible values include: "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "Sunday". + :paramtype day: str or ~azure.mgmt.scheduler.models.JobScheduleDay + :keyword occurrence: Gets or sets the occurrence. Must be between -5 and 5. + :paramtype occurrence: int + """ super(JobRecurrenceScheduleMonthlyOccurrence, self).__init__(**kwargs) self.day = day self.occurrence = occurrence @@ -829,9 +1003,9 @@ def __init__( class JobStateFilter(msrest.serialization.Model): """JobStateFilter. - :param state: Gets or sets the job state. Possible values include: "Enabled", "Disabled", + :ivar state: Gets or sets the job state. Possible values include: "Enabled", "Disabled", "Faulted", "Completed". - :type state: str or ~azure.mgmt.scheduler.models.JobState + :vartype state: str or ~azure.mgmt.scheduler.models.JobState """ _attribute_map = { @@ -844,6 +1018,11 @@ def __init__( state: Optional[Union[str, "JobState"]] = None, **kwargs ): + """ + :keyword state: Gets or sets the job state. Possible values include: "Enabled", "Disabled", + "Faulted", "Completed". + :paramtype state: str or ~azure.mgmt.scheduler.models.JobState + """ super(JobStateFilter, self).__init__(**kwargs) self.state = state @@ -888,6 +1067,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobStatus, self).__init__(**kwargs) self.execution_count = None self.failure_count = None @@ -901,17 +1082,17 @@ class OAuthAuthentication(HttpAuthentication): All required parameters must be populated in order to send to Azure. - :param type: Required. Gets or sets the HTTP authentication type.Constant filled by server. + :ivar type: Required. Gets or sets the HTTP authentication type.Constant filled by server. Possible values include: "NotSpecified", "ClientCertificate", "ActiveDirectoryOAuth", "Basic". - :type type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType - :param secret: Gets or sets the secret, return value will always be empty. - :type secret: str - :param tenant: Gets or sets the tenant. - :type tenant: str - :param audience: Gets or sets the audience. - :type audience: str - :param client_id: Gets or sets the client identifier. - :type client_id: str + :vartype type: str or ~azure.mgmt.scheduler.models.HttpAuthenticationType + :ivar secret: Gets or sets the secret, return value will always be empty. + :vartype secret: str + :ivar tenant: Gets or sets the tenant. + :vartype tenant: str + :ivar audience: Gets or sets the audience. + :vartype audience: str + :ivar client_id: Gets or sets the client identifier. + :vartype client_id: str """ _validation = { @@ -935,6 +1116,16 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword secret: Gets or sets the secret, return value will always be empty. + :paramtype secret: str + :keyword tenant: Gets or sets the tenant. + :paramtype tenant: str + :keyword audience: Gets or sets the audience. + :paramtype audience: str + :keyword client_id: Gets or sets the client identifier. + :paramtype client_id: str + """ super(OAuthAuthentication, self).__init__(**kwargs) self.type = 'ActiveDirectoryOAuth' # type: str self.secret = secret @@ -946,14 +1137,14 @@ def __init__( class RetryPolicy(msrest.serialization.Model): """RetryPolicy. - :param retry_type: Gets or sets the retry strategy to be used. Possible values include: "None", + :ivar retry_type: Gets or sets the retry strategy to be used. Possible values include: "None", "Fixed". - :type retry_type: str or ~azure.mgmt.scheduler.models.RetryType - :param retry_interval: Gets or sets the retry interval between retries, specify duration in ISO + :vartype retry_type: str or ~azure.mgmt.scheduler.models.RetryType + :ivar retry_interval: Gets or sets the retry interval between retries, specify duration in ISO 8601 format. - :type retry_interval: ~datetime.timedelta - :param retry_count: Gets or sets the number of times a retry should be attempted. - :type retry_count: int + :vartype retry_interval: ~datetime.timedelta + :ivar retry_count: Gets or sets the number of times a retry should be attempted. + :vartype retry_count: int """ _attribute_map = { @@ -970,6 +1161,16 @@ def __init__( retry_count: Optional[int] = None, **kwargs ): + """ + :keyword retry_type: Gets or sets the retry strategy to be used. Possible values include: + "None", "Fixed". + :paramtype retry_type: str or ~azure.mgmt.scheduler.models.RetryType + :keyword retry_interval: Gets or sets the retry interval between retries, specify duration in + ISO 8601 format. + :paramtype retry_interval: ~datetime.timedelta + :keyword retry_count: Gets or sets the number of times a retry should be attempted. + :paramtype retry_count: int + """ super(RetryPolicy, self).__init__(**kwargs) self.retry_type = retry_type self.retry_interval = retry_interval @@ -979,13 +1180,13 @@ def __init__( class ServiceBusAuthentication(msrest.serialization.Model): """ServiceBusAuthentication. - :param sas_key: Gets or sets the SAS key. - :type sas_key: str - :param sas_key_name: Gets or sets the SAS key name. - :type sas_key_name: str - :param type: Gets or sets the authentication type. Possible values include: "NotSpecified", + :ivar sas_key: Gets or sets the SAS key. + :vartype sas_key: str + :ivar sas_key_name: Gets or sets the SAS key name. + :vartype sas_key_name: str + :ivar type: Gets or sets the authentication type. Possible values include: "NotSpecified", "SharedAccessKey". - :type type: str or ~azure.mgmt.scheduler.models.ServiceBusAuthenticationType + :vartype type: str or ~azure.mgmt.scheduler.models.ServiceBusAuthenticationType """ _attribute_map = { @@ -1002,6 +1203,15 @@ def __init__( type: Optional[Union[str, "ServiceBusAuthenticationType"]] = None, **kwargs ): + """ + :keyword sas_key: Gets or sets the SAS key. + :paramtype sas_key: str + :keyword sas_key_name: Gets or sets the SAS key name. + :paramtype sas_key_name: str + :keyword type: Gets or sets the authentication type. Possible values include: "NotSpecified", + "SharedAccessKey". + :paramtype type: str or ~azure.mgmt.scheduler.models.ServiceBusAuthenticationType + """ super(ServiceBusAuthentication, self).__init__(**kwargs) self.sas_key = sas_key self.sas_key_name = sas_key_name @@ -1011,32 +1221,32 @@ def __init__( class ServiceBusBrokeredMessageProperties(msrest.serialization.Model): """ServiceBusBrokeredMessageProperties. - :param content_type: Gets or sets the content type. - :type content_type: str - :param correlation_id: Gets or sets the correlation ID. - :type correlation_id: str - :param force_persistence: Gets or sets the force persistence. - :type force_persistence: bool - :param label: Gets or sets the label. - :type label: str - :param message_id: Gets or sets the message ID. - :type message_id: str - :param partition_key: Gets or sets the partition key. - :type partition_key: str - :param reply_to: Gets or sets the reply to. - :type reply_to: str - :param reply_to_session_id: Gets or sets the reply to session ID. - :type reply_to_session_id: str - :param scheduled_enqueue_time_utc: Gets or sets the scheduled enqueue time UTC. - :type scheduled_enqueue_time_utc: ~datetime.datetime - :param session_id: Gets or sets the session ID. - :type session_id: str - :param time_to_live: Gets or sets the time to live. - :type time_to_live: ~datetime.timedelta - :param to: Gets or sets the to. - :type to: str - :param via_partition_key: Gets or sets the via partition key. - :type via_partition_key: str + :ivar content_type: Gets or sets the content type. + :vartype content_type: str + :ivar correlation_id: Gets or sets the correlation ID. + :vartype correlation_id: str + :ivar force_persistence: Gets or sets the force persistence. + :vartype force_persistence: bool + :ivar label: Gets or sets the label. + :vartype label: str + :ivar message_id: Gets or sets the message ID. + :vartype message_id: str + :ivar partition_key: Gets or sets the partition key. + :vartype partition_key: str + :ivar reply_to: Gets or sets the reply to. + :vartype reply_to: str + :ivar reply_to_session_id: Gets or sets the reply to session ID. + :vartype reply_to_session_id: str + :ivar scheduled_enqueue_time_utc: Gets or sets the scheduled enqueue time UTC. + :vartype scheduled_enqueue_time_utc: ~datetime.datetime + :ivar session_id: Gets or sets the session ID. + :vartype session_id: str + :ivar time_to_live: Gets or sets the time to live. + :vartype time_to_live: ~datetime.timedelta + :ivar to: Gets or sets the to. + :vartype to: str + :ivar via_partition_key: Gets or sets the via partition key. + :vartype via_partition_key: str """ _attribute_map = { @@ -1073,6 +1283,34 @@ def __init__( via_partition_key: Optional[str] = None, **kwargs ): + """ + :keyword content_type: Gets or sets the content type. + :paramtype content_type: str + :keyword correlation_id: Gets or sets the correlation ID. + :paramtype correlation_id: str + :keyword force_persistence: Gets or sets the force persistence. + :paramtype force_persistence: bool + :keyword label: Gets or sets the label. + :paramtype label: str + :keyword message_id: Gets or sets the message ID. + :paramtype message_id: str + :keyword partition_key: Gets or sets the partition key. + :paramtype partition_key: str + :keyword reply_to: Gets or sets the reply to. + :paramtype reply_to: str + :keyword reply_to_session_id: Gets or sets the reply to session ID. + :paramtype reply_to_session_id: str + :keyword scheduled_enqueue_time_utc: Gets or sets the scheduled enqueue time UTC. + :paramtype scheduled_enqueue_time_utc: ~datetime.datetime + :keyword session_id: Gets or sets the session ID. + :paramtype session_id: str + :keyword time_to_live: Gets or sets the time to live. + :paramtype time_to_live: ~datetime.timedelta + :keyword to: Gets or sets the to. + :paramtype to: str + :keyword via_partition_key: Gets or sets the via partition key. + :paramtype via_partition_key: str + """ super(ServiceBusBrokeredMessageProperties, self).__init__(**kwargs) self.content_type = content_type self.correlation_id = correlation_id @@ -1092,20 +1330,20 @@ def __init__( class ServiceBusMessage(msrest.serialization.Model): """ServiceBusMessage. - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: + :ivar authentication: Gets or sets the Service Bus authentication. + :vartype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :ivar brokered_message_properties: Gets or sets the brokered message properties. + :vartype brokered_message_properties: ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + :ivar custom_message_properties: Gets or sets the custom message properties. + :vartype custom_message_properties: dict[str, str] + :ivar message: Gets or sets the message. + :vartype message: str + :ivar namespace: Gets or sets the namespace. + :vartype namespace: str + :ivar transport_type: Gets or sets the transport type. Possible values include: "NotSpecified", + "NetMessaging", "AMQP". + :vartype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType """ _attribute_map = { @@ -1128,6 +1366,22 @@ def __init__( transport_type: Optional[Union[str, "ServiceBusTransportType"]] = None, **kwargs ): + """ + :keyword authentication: Gets or sets the Service Bus authentication. + :paramtype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :keyword brokered_message_properties: Gets or sets the brokered message properties. + :paramtype brokered_message_properties: + ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties + :keyword custom_message_properties: Gets or sets the custom message properties. + :paramtype custom_message_properties: dict[str, str] + :keyword message: Gets or sets the message. + :paramtype message: str + :keyword namespace: Gets or sets the namespace. + :paramtype namespace: str + :keyword transport_type: Gets or sets the transport type. Possible values include: + "NotSpecified", "NetMessaging", "AMQP". + :paramtype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + """ super(ServiceBusMessage, self).__init__(**kwargs) self.authentication = authentication self.brokered_message_properties = brokered_message_properties @@ -1140,22 +1394,22 @@ def __init__( class ServiceBusQueueMessage(ServiceBusMessage): """ServiceBusQueueMessage. - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: + :ivar authentication: Gets or sets the Service Bus authentication. + :vartype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :ivar brokered_message_properties: Gets or sets the brokered message properties. + :vartype brokered_message_properties: ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType - :param queue_name: Gets or sets the queue name. - :type queue_name: str + :ivar custom_message_properties: Gets or sets the custom message properties. + :vartype custom_message_properties: dict[str, str] + :ivar message: Gets or sets the message. + :vartype message: str + :ivar namespace: Gets or sets the namespace. + :vartype namespace: str + :ivar transport_type: Gets or sets the transport type. Possible values include: "NotSpecified", + "NetMessaging", "AMQP". + :vartype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + :ivar queue_name: Gets or sets the queue name. + :vartype queue_name: str """ _attribute_map = { @@ -1180,6 +1434,24 @@ def __init__( queue_name: Optional[str] = None, **kwargs ): + """ + :keyword authentication: Gets or sets the Service Bus authentication. + :paramtype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :keyword brokered_message_properties: Gets or sets the brokered message properties. + :paramtype brokered_message_properties: + ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties + :keyword custom_message_properties: Gets or sets the custom message properties. + :paramtype custom_message_properties: dict[str, str] + :keyword message: Gets or sets the message. + :paramtype message: str + :keyword namespace: Gets or sets the namespace. + :paramtype namespace: str + :keyword transport_type: Gets or sets the transport type. Possible values include: + "NotSpecified", "NetMessaging", "AMQP". + :paramtype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + :keyword queue_name: Gets or sets the queue name. + :paramtype queue_name: str + """ super(ServiceBusQueueMessage, self).__init__(authentication=authentication, brokered_message_properties=brokered_message_properties, custom_message_properties=custom_message_properties, message=message, namespace=namespace, transport_type=transport_type, **kwargs) self.queue_name = queue_name @@ -1187,22 +1459,22 @@ def __init__( class ServiceBusTopicMessage(ServiceBusMessage): """ServiceBusTopicMessage. - :param authentication: Gets or sets the Service Bus authentication. - :type authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication - :param brokered_message_properties: Gets or sets the brokered message properties. - :type brokered_message_properties: + :ivar authentication: Gets or sets the Service Bus authentication. + :vartype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :ivar brokered_message_properties: Gets or sets the brokered message properties. + :vartype brokered_message_properties: ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties - :param custom_message_properties: Gets or sets the custom message properties. - :type custom_message_properties: dict[str, str] - :param message: Gets or sets the message. - :type message: str - :param namespace: Gets or sets the namespace. - :type namespace: str - :param transport_type: Gets or sets the transport type. Possible values include: - "NotSpecified", "NetMessaging", "AMQP". - :type transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType - :param topic_path: Gets or sets the topic path. - :type topic_path: str + :ivar custom_message_properties: Gets or sets the custom message properties. + :vartype custom_message_properties: dict[str, str] + :ivar message: Gets or sets the message. + :vartype message: str + :ivar namespace: Gets or sets the namespace. + :vartype namespace: str + :ivar transport_type: Gets or sets the transport type. Possible values include: "NotSpecified", + "NetMessaging", "AMQP". + :vartype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + :ivar topic_path: Gets or sets the topic path. + :vartype topic_path: str """ _attribute_map = { @@ -1227,6 +1499,24 @@ def __init__( topic_path: Optional[str] = None, **kwargs ): + """ + :keyword authentication: Gets or sets the Service Bus authentication. + :paramtype authentication: ~azure.mgmt.scheduler.models.ServiceBusAuthentication + :keyword brokered_message_properties: Gets or sets the brokered message properties. + :paramtype brokered_message_properties: + ~azure.mgmt.scheduler.models.ServiceBusBrokeredMessageProperties + :keyword custom_message_properties: Gets or sets the custom message properties. + :paramtype custom_message_properties: dict[str, str] + :keyword message: Gets or sets the message. + :paramtype message: str + :keyword namespace: Gets or sets the namespace. + :paramtype namespace: str + :keyword transport_type: Gets or sets the transport type. Possible values include: + "NotSpecified", "NetMessaging", "AMQP". + :paramtype transport_type: str or ~azure.mgmt.scheduler.models.ServiceBusTransportType + :keyword topic_path: Gets or sets the topic path. + :paramtype topic_path: str + """ super(ServiceBusTopicMessage, self).__init__(authentication=authentication, brokered_message_properties=brokered_message_properties, custom_message_properties=custom_message_properties, message=message, namespace=namespace, transport_type=transport_type, **kwargs) self.topic_path = topic_path @@ -1234,9 +1524,9 @@ def __init__( class Sku(msrest.serialization.Model): """Sku. - :param name: Gets or set the SKU. Possible values include: "Standard", "Free", "P10Premium", + :ivar name: Gets or set the SKU. Possible values include: "Standard", "Free", "P10Premium", "P20Premium". - :type name: str or ~azure.mgmt.scheduler.models.SkuDefinition + :vartype name: str or ~azure.mgmt.scheduler.models.SkuDefinition """ _attribute_map = { @@ -1249,6 +1539,11 @@ def __init__( name: Optional[Union[str, "SkuDefinition"]] = None, **kwargs ): + """ + :keyword name: Gets or set the SKU. Possible values include: "Standard", "Free", "P10Premium", + "P20Premium". + :paramtype name: str or ~azure.mgmt.scheduler.models.SkuDefinition + """ super(Sku, self).__init__(**kwargs) self.name = name @@ -1256,14 +1551,14 @@ def __init__( class StorageQueueMessage(msrest.serialization.Model): """StorageQueueMessage. - :param storage_account: Gets or sets the storage account name. - :type storage_account: str - :param queue_name: Gets or sets the queue name. - :type queue_name: str - :param sas_token: Gets or sets the SAS key. - :type sas_token: str - :param message: Gets or sets the message. - :type message: str + :ivar storage_account: Gets or sets the storage account name. + :vartype storage_account: str + :ivar queue_name: Gets or sets the queue name. + :vartype queue_name: str + :ivar sas_token: Gets or sets the SAS key. + :vartype sas_token: str + :ivar message: Gets or sets the message. + :vartype message: str """ _attribute_map = { @@ -1282,6 +1577,16 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword storage_account: Gets or sets the storage account name. + :paramtype storage_account: str + :keyword queue_name: Gets or sets the queue name. + :paramtype queue_name: str + :keyword sas_token: Gets or sets the SAS key. + :paramtype sas_token: str + :keyword message: Gets or sets the message. + :paramtype message: str + """ super(StorageQueueMessage, self).__init__(**kwargs) self.storage_account = storage_account self.queue_name = queue_name diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_scheduler_management_client_enums.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_scheduler_management_client_enums.py index a71e95d12e36..a98efa6879f2 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_scheduler_management_client_enums.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_scheduler_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -36,7 +21,7 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class HttpAuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpAuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the HTTP authentication type. """ @@ -45,7 +30,7 @@ class HttpAuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) ACTIVE_DIRECTORY_O_AUTH = "ActiveDirectoryOAuth" BASIC = "Basic" -class JobActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the job action type. """ @@ -55,7 +40,7 @@ class JobActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE_BUS_QUEUE = "ServiceBusQueue" SERVICE_BUS_TOPIC = "ServiceBusTopic" -class JobCollectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobCollectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the state. """ @@ -64,7 +49,7 @@ class JobCollectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" DELETED = "Deleted" -class JobExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobExecutionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the job execution status. """ @@ -72,14 +57,14 @@ class JobExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" POSTPONED = "Postponed" -class JobHistoryActionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobHistoryActionName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the job history action name. """ MAIN_ACTION = "MainAction" ERROR_ACTION = "ErrorAction" -class JobScheduleDay(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobScheduleDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. """ @@ -92,7 +77,7 @@ class JobScheduleDay(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SATURDAY = "Saturday" SUNDAY = "Sunday" -class JobState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or set the job state. """ @@ -101,7 +86,7 @@ class JobState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAULTED = "Faulted" COMPLETED = "Completed" -class RecurrenceFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RecurrenceFrequency(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). """ @@ -111,21 +96,21 @@ class RecurrenceFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WEEK = "Week" MONTH = "Month" -class RetryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RetryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the retry strategy to be used. """ NONE = "None" FIXED = "Fixed" -class ServiceBusAuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceBusAuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the authentication type. """ NOT_SPECIFIED = "NotSpecified" SHARED_ACCESS_KEY = "SharedAccessKey" -class ServiceBusTransportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceBusTransportType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the transport type. """ @@ -133,7 +118,7 @@ class ServiceBusTransportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum NET_MESSAGING = "NetMessaging" AMQP = "AMQP" -class SkuDefinition(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuDefinition(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or set the SKU. """ diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_job_collections_operations.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_job_collections_operations.py index 16e37a498e98..ef0c3765d3d1 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_job_collections_operations.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_job_collections_operations.py @@ -5,25 +5,302 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_enable_request_initial( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_disable_request_initial( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class JobCollectionsOperations(object): """JobCollectionsOperations operations. @@ -39,7 +316,7 @@ class JobCollectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -47,51 +324,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.JobCollectionListResult"] + **kwargs: Any + ) -> Iterable["_models.JobCollectionListResult"]: """Gets all job collections under specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobCollectionListResult or the result of cls(response) + :return: An iterator like instance of either JobCollectionListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollectionListResult', pipeline_response) + deserialized = self._deserialize("JobCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,60 +382,58 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.JobCollectionListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.JobCollectionListResult"]: """Gets all job collections under specified resource group. :param resource_group_name: The resource group name. :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 JobCollectionListResult or the result of cls(response) + :return: An iterator like instance of either JobCollectionListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scheduler.models.JobCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollectionListResult', pipeline_response) + deserialized = self._deserialize("JobCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,18 +451,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.JobCollectionDefinition" + resource_group_name: str, + job_collection_name: str, + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Gets a job collection. :param resource_group_name: The resource group name. @@ -203,32 +475,22 @@ def get( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,16 +504,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_collection, # type: "models.JobCollectionDefinition" - **kwargs # type: Any - ): - # type: (...) -> "models.JobCollectionDefinition" + resource_group_name: str, + job_collection_name: str, + job_collection: "_models.JobCollectionDefinition", + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Provisions a new job collection or updates an existing job collection. :param resource_group_name: The resource group name. @@ -265,37 +529,27 @@ def create_or_update( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(job_collection, 'JobCollectionDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_collection, 'JobCollectionDefinition') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -313,16 +567,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_collection, # type: "models.JobCollectionDefinition" - **kwargs # type: Any - ): - # type: (...) -> "models.JobCollectionDefinition" + resource_group_name: str, + job_collection_name: str, + job_collection: "_models.JobCollectionDefinition", + **kwargs: Any + ) -> "_models.JobCollectionDefinition": """Patches an existing job collection. :param resource_group_name: The resource group name. @@ -336,37 +592,27 @@ def patch( :rtype: ~azure.mgmt.scheduler.models.JobCollectionDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobCollectionDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollectionDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(job_collection, 'JobCollectionDefinition') + + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_collection, 'JobCollectionDefinition') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,39 +626,32 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + job_collection_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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -425,13 +664,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + job_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a job collection. :param resource_group_name: The resource group name. @@ -440,15 +680,17 @@ def begin_delete( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -462,15 +704,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -482,39 +723,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'} # type: ignore def _enable_initial( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + job_collection_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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._enable_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_enable_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._enable_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -527,13 +760,14 @@ def _enable_initial( _enable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable'} # type: ignore + + @distributed_trace def begin_enable( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + job_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Enables all of the jobs in the job collection. :param resource_group_name: The resource group name. @@ -542,15 +776,17 @@ def begin_enable( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -564,15 +800,14 @@ def begin_enable( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -584,39 +819,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable'} # type: ignore def _disable_initial( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + job_collection_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', {})) - api_version = "2016-03-01" - - # Construct URL - url = self._disable_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_disable_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + template_url=self._disable_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -629,13 +856,14 @@ def _disable_initial( _disable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable'} # type: ignore + + @distributed_trace def begin_disable( self, - resource_group_name, # type: str - job_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + job_collection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disables all of the jobs in the job collection. :param resource_group_name: The resource group name. @@ -644,15 +872,17 @@ def begin_disable( :type job_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -666,15 +896,14 @@ def begin_disable( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -686,4 +915,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable'} # type: ignore diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_jobs_operations.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_jobs_operations.py index 8dc2e209a16f..5b9f4cc1d903 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_jobs_operations.py +++ b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/operations/_jobs_operations.py @@ -5,23 +5,309 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_run_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + } + + 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') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_job_history_request( + subscription_id: str, + resource_group_name: str, + job_collection_name: str, + job_name: str, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-03-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "jobCollectionName": _SERIALIZER.url("job_collection_name", job_collection_name, 'str'), + "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + } + + 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') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -37,7 +323,7 @@ class JobsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,14 +331,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.JobDefinition" + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any + ) -> "_models.JobDefinition": """Gets a job. :param resource_group_name: The resource group name. @@ -66,33 +352,23 @@ def get( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,17 +382,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - job, # type: "models.JobDefinition" - **kwargs # type: Any - ): - # type: (...) -> "models.JobDefinition" + resource_group_name: str, + job_collection_name: str, + job_name: str, + job: "_models.JobDefinition", + **kwargs: Any + ) -> "_models.JobDefinition": """Provisions a new job or updates an existing job. :param resource_group_name: The resource group name. @@ -132,38 +410,28 @@ def create_or_update( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(job, 'JobDefinition') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job, 'JobDefinition') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,17 +449,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - job, # type: "models.JobDefinition" - **kwargs # type: Any - ): - # type: (...) -> "models.JobDefinition" + resource_group_name: str, + job_collection_name: str, + job_name: str, + job: "_models.JobDefinition", + **kwargs: Any + ) -> "_models.JobDefinition": """Patches an existing job. :param resource_group_name: The resource group name. @@ -207,38 +477,28 @@ def patch( :rtype: ~azure.mgmt.scheduler.models.JobDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(job, 'JobDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job, 'JobDefinition') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,16 +512,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any + ) -> None: """Deletes a job. :param resource_group_name: The resource group name. @@ -280,26 +542,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,14 +566,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def run( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + job_collection_name: str, + job_name: str, + **kwargs: Any + ) -> None: """Runs a job. :param resource_group_name: The resource group name. @@ -338,26 +593,18 @@ def run( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - - # Construct URL - url = self.run.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_run_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + template_url=self.run.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,16 +617,17 @@ def run( run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - job_collection_name, # type: str - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.JobListResult"] + resource_group_name: str, + job_collection_name: str, + top: Optional[int] = None, + skip: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.JobListResult"]: """Lists all jobs under the specified job collection. :param resource_group_name: The resource group name. @@ -398,47 +646,44 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scheduler.models.JobListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + top=top, + skip=skip, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + top=top, + skip=skip, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('JobListResult', pipeline_response) + deserialized = self._deserialize("JobListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -456,22 +701,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs'} # type: ignore + @distributed_trace def list_job_history( self, - resource_group_name, # type: str - job_collection_name, # type: str - job_name, # type: str - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.JobHistoryListResult"] + resource_group_name: str, + job_collection_name: str, + job_name: str, + top: Optional[int] = None, + skip: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.JobHistoryListResult"]: """Lists job history. :param resource_group_name: The resource group name. @@ -488,52 +734,51 @@ def list_job_history( :param filter: The filter to apply on the job state. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobHistoryListResult or the result of cls(response) + :return: An iterator like instance of either JobHistoryListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scheduler.models.JobHistoryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.JobHistoryListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobHistoryListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-03-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_job_history.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'jobCollectionName': self._serialize.url("job_collection_name", job_collection_name, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_job_history_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + top=top, + skip=skip, + filter=filter, + template_url=self.list_job_history.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_job_history_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + job_collection_name=job_collection_name, + job_name=job_name, + top=top, + skip=skip, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('JobHistoryListResult', pipeline_response) + deserialized = self._deserialize("JobHistoryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -551,6 +796,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/patch.py b/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/patch.py deleted file mode 100644 index 31b17803f148..000000000000 --- a/sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/patch.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -# Retry policy -# 20 seconds => "retryType": "fixed", "retryInterval": "00:00:20", -# 20 minutes => "retryType": "fixed", "retryInterval": "00:20:00", -# 1 hours => "retryType": "fixed", "retryInterval": "01:00:00", -# 2 days => "retryType": "fixed", "retryInterval": "60.00:00:00", -# default => "retryType": "fixed" -# none => "retryType": "none" -import datetime -import re -import isodate -import msrest.serialization - -_TIMESPAN_MATCHER = re.compile(r"([\d]+\.)?(\d\d):(\d\d):(\d\d)") - -def from_timespan_to_iso8601(timespan_str): - match = _TIMESPAN_MATCHER.match(timespan_str) - groups = match.groups() - int_groups = [int(groups[0][:-1]) if groups[0] else 0] - int_groups += [int(v) for v in groups[1:]] - - return "P{}DT{}H{}M{}S".format( - int(int_groups[0] / 30), - int_groups[1], - int_groups[2], - int_groups[3] - ) - -def from_iso8601_to_timespan(iso_str): - # Be sure to handle str + isodate.Duration + timedelta - iso_str = msrest.serialization.Serializer.serialize_duration(iso_str) - iso_obj = isodate.parse_duration(iso_str) - hours_str = "{:02d}:{:02d}:{:02d}".format( - iso_obj.seconds // 3600, # hours - iso_obj.seconds % 3600 // 60, # minutes - iso_obj.seconds % 3600 % 60 # seconds - ) - return "{}.{}".format(iso_obj.days * 30, hours_str) if iso_obj.days else hours_str - -def serialize_scheduler_duration(attr, **kwargs): - return from_iso8601_to_timespan(attr) - -def deserialize_scheduler_duration(attr, **kwargs): - value = from_timespan_to_iso8601(attr) - return msrest.serialization.Deserializer.deserialize_duration(value) - -def patch_client(client): - client._serialize.serialize_type['duration'] = serialize_scheduler_duration - client._deserialize.deserialize_type ['duration'] = deserialize_scheduler_duration