From c4e984af8b2e294b5b81c3f36748dbdb7892e82c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 15 Mar 2022 03:44:36 +0000 Subject: [PATCH] CodeGen from PR 18208 in Azure/azure-rest-api-specs Merge 4772ab9f3e13afc920d577bea23077ec30e32528 into 2abe647120f14bb145968a5543ead8ed51394498 --- .../azure-mgmt-guestconfig/_meta.json | 10 +- .../azure/mgmt/guestconfig/__init__.py | 9 +- .../azure/mgmt/guestconfig/_configuration.py | 19 +- .../_guest_configuration_client.py | 117 +-- .../azure/mgmt/guestconfig/_metadata.json | 21 +- .../azure/mgmt/guestconfig/_patch.py | 31 + .../azure/mgmt/guestconfig/_vendor.py | 27 + .../azure/mgmt/guestconfig/aio/__init__.py | 5 + .../mgmt/guestconfig/aio/_configuration.py | 6 +- .../aio/_guest_configuration_client.py | 105 +- .../azure/mgmt/guestconfig/aio/_patch.py | 31 + ...iguration_assignment_reports_operations.py | 80 +- ...st_configuration_assignments_operations.py | 313 ++++-- ...tion_hcrp_assignment_reports_operations.py | 80 +- ...nfiguration_hcrp_assignments_operations.py | 176 ++-- .../guestconfig/aio/operations/_operations.py | 44 +- .../azure/mgmt/guestconfig/models/__init__.py | 74 +- .../_guest_configuration_client_enums.py | 33 +- .../azure/mgmt/guestconfig/models/_models.py | 843 ---------------- .../mgmt/guestconfig/models/_models_py3.py | 470 +++++++-- ...iguration_assignment_reports_operations.py | 192 ++-- ...st_configuration_assignments_operations.py | 588 ++++++++--- ...tion_hcrp_assignment_reports_operations.py | 192 ++-- ...nfiguration_hcrp_assignments_operations.py | 387 ++++--- .../guestconfig/operations/_operations.py | 85 +- .../_meta.json | 11 +- .../mgmt/machinelearningcompute/__init__.py | 9 +- .../machinelearningcompute/_configuration.py | 19 +- ...hine_learning_compute_management_client.py | 88 +- .../machinelearningcompute/_metadata.json | 21 +- .../mgmt/machinelearningcompute/_patch.py | 31 + .../mgmt/machinelearningcompute/_vendor.py | 27 + .../machinelearningcompute/aio/__init__.py | 5 + .../aio/_configuration.py | 6 +- ...hine_learning_compute_management_client.py | 76 +- .../mgmt/machinelearningcompute/aio/_patch.py | 31 + .../_machine_learning_compute_operations.py | 32 +- ..._operationalization_clusters_operations.py | 474 ++++----- .../machinelearningcompute/models/__init__.py | 87 +- ...earning_compute_management_client_enums.py | 33 +- .../machinelearningcompute/models/_models.py | 954 ------------------ .../models/_models_py3.py | 498 ++++++--- .../_machine_learning_compute_operations.py | 72 +- ..._operationalization_clusters_operations.py | 917 +++++++++++------ 44 files changed, 3547 insertions(+), 3782 deletions(-) create mode 100644 sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_patch.py create mode 100644 sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_vendor.py create mode 100644 sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_patch.py delete mode 100644 sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_patch.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_vendor.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_patch.py delete mode 100644 sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models.py diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json b/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json index acfcecc0577c..6c36618a4643 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json +++ b/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "33b8d6f7bf2eb081fe134333b0fc445777e488d6", + "commit": "d6191d641c750189751bde4466749fa589265abc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/guestconfiguration/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/guestconfiguration/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/guestconfiguration/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/__init__.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/__init__.py index decfff5bcc08..5a1f8a26a15b 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/__init__.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['GuestConfigurationClient'] -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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_configuration.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_configuration.py index 9aa902bd4745..f21cccd3abaf 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_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 GuestConfigurationClientConfiguration(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(GuestConfigurationClientConfiguration, 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(GuestConfigurationClientConfiguration, 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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_guest_configuration_client.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_guest_configuration_client.py index 01babb7e9978..944ac8f909b3 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_guest_configuration_client.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_guest_configuration_client.py @@ -6,93 +6,96 @@ # 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 GuestConfigurationClientConfiguration +from .operations import GuestConfigurationAssignmentReportsOperations, GuestConfigurationAssignmentsOperations, GuestConfigurationHCRPAssignmentReportsOperations, GuestConfigurationHCRPAssignmentsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import GuestConfigurationClientConfiguration -from .operations import GuestConfigurationAssignmentsOperations -from .operations import GuestConfigurationAssignmentReportsOperations -from .operations import GuestConfigurationHCRPAssignmentsOperations -from .operations import GuestConfigurationHCRPAssignmentReportsOperations -from .operations import Operations -from . import models - -class GuestConfigurationClient(object): +class GuestConfigurationClient: """Guest Configuration Client. :ivar guest_configuration_assignments: GuestConfigurationAssignmentsOperations operations - :vartype guest_configuration_assignments: azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsOperations - :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations operations - :vartype guest_configuration_assignment_reports: azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsOperations - :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations operations - :vartype guest_configuration_hcrp_assignments: azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentsOperations - :ivar guest_configuration_hcrp_assignment_reports: GuestConfigurationHCRPAssignmentReportsOperations operations - :vartype guest_configuration_hcrp_assignment_reports: azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentReportsOperations + :vartype guest_configuration_assignments: + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsOperations + :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations + operations + :vartype guest_configuration_assignment_reports: + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsOperations + :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations + operations + :vartype guest_configuration_hcrp_assignments: + azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentsOperations + :ivar guest_configuration_hcrp_assignment_reports: + GuestConfigurationHCRPAssignmentReportsOperations operations + :vartype guest_configuration_hcrp_assignment_reports: + azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentReportsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.guestconfig.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. + The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ 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 = GuestConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = GuestConfigurationClientConfiguration(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.guest_configuration_assignments = GuestConfigurationAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_assignments = GuestConfigurationAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json index 8b0f39452c80..8ab8598473a7 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json @@ -5,13 +5,13 @@ "name": "GuestConfigurationClient", "filename": "_guest_configuration_client", "description": "Guest Configuration Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "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\": [\"GuestConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"GuestConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"GuestConfigurationClientConfiguration\"]}}, \"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\": [\"GuestConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "guest_configuration_assignments": "GuestConfigurationAssignmentsOperations", diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_patch.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_vendor.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/__init__.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/__init__.py index 87d64022a9db..d4ac83dd9454 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/__init__.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/__init__.py @@ -8,3 +8,8 @@ from ._guest_configuration_client import GuestConfigurationClient __all__ = ['GuestConfigurationClient'] + +# `._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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_configuration.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_configuration.py index 7197706b1623..15e6c3467f24 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/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(GuestConfigurationClientConfiguration, 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(GuestConfigurationClientConfiguration, 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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_guest_configuration_client.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_guest_configuration_client.py index 988d61a32321..7c636cf4ed94 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_guest_configuration_client.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_guest_configuration_client.py @@ -6,89 +6,96 @@ # 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.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import GuestConfigurationClientConfiguration +from .operations import GuestConfigurationAssignmentReportsOperations, GuestConfigurationAssignmentsOperations, GuestConfigurationHCRPAssignmentReportsOperations, GuestConfigurationHCRPAssignmentsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import GuestConfigurationClientConfiguration -from .operations import GuestConfigurationAssignmentsOperations -from .operations import GuestConfigurationAssignmentReportsOperations -from .operations import GuestConfigurationHCRPAssignmentsOperations -from .operations import GuestConfigurationHCRPAssignmentReportsOperations -from .operations import Operations -from .. import models - - -class GuestConfigurationClient(object): +class GuestConfigurationClient: """Guest Configuration Client. :ivar guest_configuration_assignments: GuestConfigurationAssignmentsOperations operations - :vartype guest_configuration_assignments: azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentsOperations - :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations operations - :vartype guest_configuration_assignment_reports: azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentReportsOperations - :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations operations - :vartype guest_configuration_hcrp_assignments: azure.mgmt.guestconfig.aio.operations.GuestConfigurationHCRPAssignmentsOperations - :ivar guest_configuration_hcrp_assignment_reports: GuestConfigurationHCRPAssignmentReportsOperations operations - :vartype guest_configuration_hcrp_assignment_reports: azure.mgmt.guestconfig.aio.operations.GuestConfigurationHCRPAssignmentReportsOperations + :vartype guest_configuration_assignments: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentsOperations + :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations + operations + :vartype guest_configuration_assignment_reports: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentReportsOperations + :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations + operations + :vartype guest_configuration_hcrp_assignments: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationHCRPAssignmentsOperations + :ivar guest_configuration_hcrp_assignment_reports: + GuestConfigurationHCRPAssignmentReportsOperations operations + :vartype guest_configuration_hcrp_assignment_reports: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationHCRPAssignmentReportsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.guestconfig.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. + The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ 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 = GuestConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = GuestConfigurationClientConfiguration(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.guest_configuration_assignments = GuestConfigurationAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.guest_configuration_assignments = GuestConfigurationAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_patch.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_operations.py index a3b276b4a139..8fdc0e20a8a5 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from 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_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._guest_configuration_assignment_reports_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,34 +70,24 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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_list_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_name, + template_url=self.list.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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReportList', pipeline_response) @@ -101,8 +96,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -131,35 +129,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'reportId': self._serialize.url("report_id", report_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + report_id=report_id, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) @@ -168,4 +156,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_operations.py index cd28e6abc4d2..e8a437720571 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_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 as _models - +from ..._vendor import _convert_request +from ...operations._guest_configuration_assignments_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_rg_list_request, build_subscription_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, guest_configuration_assignment_name: str, @@ -69,39 +75,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'vmName': self._serialize.url("vm_name", vm_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(parameters, 'GuestConfigurationAssignment') + + request = build_create_or_update_request( + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vm_name=vm_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(parameters, 'GuestConfigurationAssignment') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -114,8 +110,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,34 +140,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -177,8 +166,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -204,34 +196,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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_delete_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -239,6 +221,145 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace + def subscription_list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_subscription_list_request( + subscription_id=self._config.subscription_id, + template_url=self.subscription_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_subscription_list_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("GuestConfigurationAssignmentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + subscription_list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + + @distributed_trace + def rg_list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for a 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 GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_rg_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.rg_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_rg_list_request( + resource_group_name=resource_group_name, + 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("GuestConfigurationAssignmentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + rg_list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -252,8 +373,10 @@ def list( :param vm_name: The name of the virtual machine. :type vm_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] @@ -261,36 +384,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vm_name=vm_name, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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('GuestConfigurationAssignmentList', pipeline_response) + deserialized = self._deserialize("GuestConfigurationAssignmentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -303,12 +423,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_reports_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_reports_operations.py index 688dddd417e2..7fdc7b9ac625 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_reports_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_reports_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from 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_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._guest_configuration_hcrp_assignment_reports_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,34 +70,24 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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_list_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_name, + template_url=self.list.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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReportList', pipeline_response) @@ -101,8 +96,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -131,35 +129,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'reportId': self._serialize.url("report_id", report_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + report_id=report_id, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) @@ -168,4 +156,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignments_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignments_operations.py index 363a7f8cb58c..6b5cc14c03f6 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignments_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_hcrp_assignments_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 as _models - +from ..._vendor import _convert_request +from ...operations._guest_configuration_hcrp_assignments_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, guest_configuration_assignment_name: str, @@ -69,39 +75,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'machineName': self._serialize.url("machine_name", machine_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(parameters, 'GuestConfigurationAssignment') + + request = build_create_or_update_request( + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + machine_name=machine_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(parameters, 'GuestConfigurationAssignment') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -114,8 +110,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,34 +140,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -177,8 +166,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -204,34 +196,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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_delete_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -239,6 +221,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -252,8 +236,10 @@ def list( :param machine_name: The name of the ARC machine. :type machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] @@ -261,36 +247,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + machine_name=machine_name, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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('GuestConfigurationAssignmentList', pipeline_response) + deserialized = self._deserialize("GuestConfigurationAssignmentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -303,12 +286,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_operations.py index 7b7206df99df..67780c0e187a 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_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 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 as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + 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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +96,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/__init__.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/__init__.py index 1fbc819ce4c0..30e46367cbf2 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/__init__.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/__init__.py @@ -6,54 +6,31 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AssignmentInfo - from ._models_py3 import AssignmentReport - from ._models_py3 import AssignmentReportDetails - from ._models_py3 import AssignmentReportResource - from ._models_py3 import AssignmentReportResourceComplianceReason - from ._models_py3 import ConfigurationInfo - from ._models_py3 import ConfigurationParameter - from ._models_py3 import ConfigurationSetting - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseError - from ._models_py3 import GuestConfigurationAssignment - from ._models_py3 import GuestConfigurationAssignmentList - from ._models_py3 import GuestConfigurationAssignmentProperties - from ._models_py3 import GuestConfigurationAssignmentReport - from ._models_py3 import GuestConfigurationAssignmentReportList - from ._models_py3 import GuestConfigurationAssignmentReportProperties - from ._models_py3 import GuestConfigurationNavigation - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import VMInfo -except (SyntaxError, ImportError): - from ._models import AssignmentInfo # type: ignore - from ._models import AssignmentReport # type: ignore - from ._models import AssignmentReportDetails # type: ignore - from ._models import AssignmentReportResource # type: ignore - from ._models import AssignmentReportResourceComplianceReason # type: ignore - from ._models import ConfigurationInfo # type: ignore - from ._models import ConfigurationParameter # type: ignore - from ._models import ConfigurationSetting # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseError # type: ignore - from ._models import GuestConfigurationAssignment # type: ignore - from ._models import GuestConfigurationAssignmentList # type: ignore - from ._models import GuestConfigurationAssignmentProperties # type: ignore - from ._models import GuestConfigurationAssignmentReport # type: ignore - from ._models import GuestConfigurationAssignmentReportList # type: ignore - from ._models import GuestConfigurationAssignmentReportProperties # type: ignore - from ._models import GuestConfigurationNavigation # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import VMInfo # type: ignore +from ._models_py3 import AssignmentInfo +from ._models_py3 import AssignmentReport +from ._models_py3 import AssignmentReportDetails +from ._models_py3 import AssignmentReportResource +from ._models_py3 import AssignmentReportResourceComplianceReason +from ._models_py3 import ConfigurationInfo +from ._models_py3 import ConfigurationParameter +from ._models_py3 import ConfigurationSetting +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseError +from ._models_py3 import GuestConfigurationAssignment +from ._models_py3 import GuestConfigurationAssignmentList +from ._models_py3 import GuestConfigurationAssignmentProperties +from ._models_py3 import GuestConfigurationAssignmentReport +from ._models_py3 import GuestConfigurationAssignmentReportList +from ._models_py3 import GuestConfigurationAssignmentReportProperties +from ._models_py3 import GuestConfigurationNavigation +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import VMInfo +from ._models_py3 import VMSSVMInfo + from ._guest_configuration_client_enums import ( ActionAfterReboot, @@ -89,6 +66,7 @@ 'ProxyResource', 'Resource', 'VMInfo', + 'VMSSVMInfo', 'ActionAfterReboot', 'AssignmentType', 'ComplianceStatus', diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_guest_configuration_client_enums.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_guest_configuration_client_enums.py index eda3b3097555..837da56bb626 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_guest_configuration_client_enums.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_guest_configuration_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 ActionAfterReboot(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionAfterReboot(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration """ @@ -34,7 +19,7 @@ class ActionAfterReboot(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CONTINUE_CONFIGURATION = "ContinueConfiguration" STOP_CONFIGURATION = "StopConfiguration" -class AssignmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AssignmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. """ @@ -44,7 +29,7 @@ class AssignmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APPLY_AND_AUTO_CORRECT = "ApplyAndAutoCorrect" APPLY_AND_MONITOR = "ApplyAndMonitor" -class ComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A value indicating compliance status of the machine for the assigned guest configuration. """ @@ -52,7 +37,7 @@ class ComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_COMPLIANT = "NonCompliant" PENDING = "Pending" -class ConfigurationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. """ @@ -61,13 +46,13 @@ class ConfigurationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APPLY_AND_MONITOR = "ApplyAndMonitor" APPLY_AND_AUTO_CORRECT = "ApplyAndAutoCorrect" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Kind of the guest configuration. For example:DSC """ DSC = "DSC" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ @@ -76,7 +61,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CANCELED = "Canceled" CREATED = "Created" -class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of report, Consistency or Initial """ diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models.py deleted file mode 100644 index b3a277e772d4..000000000000 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models.py +++ /dev/null @@ -1,843 +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. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AssignmentInfo(msrest.serialization.Model): - """Information about the guest configuration assignment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the guest configuration assignment. - :vartype name: str - :param configuration: Information about the configuration. - :type configuration: ~azure.mgmt.guestconfig.models.ConfigurationInfo - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'ConfigurationInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(AssignmentInfo, self).__init__(**kwargs) - self.name = None - self.configuration = kwargs.get('configuration', None) - - -class AssignmentReport(msrest.serialization.Model): - """AssignmentReport. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ARM resource id of the report for the guest configuration assignment. - :vartype id: str - :ivar report_id: GUID that identifies the guest configuration assignment report under a - subscription, resource group. - :vartype report_id: str - :param assignment: Configuration details of the guest configuration assignment. - :type assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo - :param vm: Information about the VM. - :type vm: ~azure.mgmt.guestconfig.models.VMInfo - :ivar start_time: Start date and time of the guest configuration assignment compliance status - check. - :vartype start_time: ~datetime.datetime - :ivar end_time: End date and time of the guest configuration assignment compliance status - check. - :vartype end_time: ~datetime.datetime - :ivar compliance_status: A value indicating compliance status of the machine for the assigned - guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". - :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus - :ivar operation_type: Type of report, Consistency or Initial. Possible values include: - "Consistency", "Initial". - :vartype operation_type: str or ~azure.mgmt.guestconfig.models.Type - :param resources: The list of resources for which guest configuration assignment compliance is - checked. - :type resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] - """ - - _validation = { - 'id': {'readonly': True}, - 'report_id': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'compliance_status': {'readonly': True}, - 'operation_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'report_id': {'key': 'reportId', 'type': 'str'}, - 'assignment': {'key': 'assignment', 'type': 'AssignmentInfo'}, - 'vm': {'key': 'vm', 'type': 'VMInfo'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[AssignmentReportResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(AssignmentReport, self).__init__(**kwargs) - self.id = None - self.report_id = None - self.assignment = kwargs.get('assignment', None) - self.vm = kwargs.get('vm', None) - self.start_time = None - self.end_time = None - self.compliance_status = None - self.operation_type = None - self.resources = kwargs.get('resources', None) - - -class AssignmentReportDetails(msrest.serialization.Model): - """Details of the guest configuration assignment report. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_status: A value indicating compliance status of the machine for the assigned - guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". - :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus - :ivar start_time: Start date and time of the guest configuration assignment compliance status - check. - :vartype start_time: ~datetime.datetime - :ivar end_time: End date and time of the guest configuration assignment compliance status - check. - :vartype end_time: ~datetime.datetime - :ivar job_id: GUID of the report. - :vartype job_id: str - :ivar operation_type: Type of report, Consistency or Initial. Possible values include: - "Consistency", "Initial". - :vartype operation_type: str or ~azure.mgmt.guestconfig.models.Type - :param resources: The list of resources for which guest configuration assignment compliance is - checked. - :type resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] - """ - - _validation = { - 'compliance_status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'job_id': {'readonly': True}, - 'operation_type': {'readonly': True}, - } - - _attribute_map = { - 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[AssignmentReportResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(AssignmentReportDetails, self).__init__(**kwargs) - self.compliance_status = None - self.start_time = None - self.end_time = None - self.job_id = None - self.operation_type = None - self.resources = kwargs.get('resources', None) - - -class AssignmentReportResource(msrest.serialization.Model): - """The guest configuration assignment resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_status: A value indicating compliance status of the machine for the assigned - guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". - :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus - :ivar resource_id: Name of the guest configuration assignment resource setting. - :vartype resource_id: str - :param reasons: Compliance reason and reason code for a resource. - :type reasons: list[~azure.mgmt.guestconfig.models.AssignmentReportResourceComplianceReason] - :ivar properties: Properties of a guest configuration assignment resource. - :vartype properties: any - """ - - _validation = { - 'compliance_status': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'reasons': {'key': 'reasons', 'type': '[AssignmentReportResourceComplianceReason]'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(AssignmentReportResource, self).__init__(**kwargs) - self.compliance_status = None - self.resource_id = None - self.reasons = kwargs.get('reasons', None) - self.properties = None - - -class AssignmentReportResourceComplianceReason(msrest.serialization.Model): - """Reason and code for the compliance of the guest configuration assignment resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar phrase: Reason for the compliance of the guest configuration assignment resource. - :vartype phrase: str - :ivar code: Code for the compliance of the guest configuration assignment resource. - :vartype code: str - """ - - _validation = { - 'phrase': {'readonly': True}, - 'code': {'readonly': True}, - } - - _attribute_map = { - 'phrase': {'key': 'phrase', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssignmentReportResourceComplianceReason, self).__init__(**kwargs) - self.phrase = None - self.code = None - - -class ConfigurationInfo(msrest.serialization.Model): - """Information about the configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the configuration. - :vartype name: str - :ivar version: Version of the configuration. - :vartype version: str - """ - - _validation = { - 'name': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationInfo, self).__init__(**kwargs) - self.name = None - self.version = None - - -class ConfigurationParameter(msrest.serialization.Model): - """Represents a configuration parameter. - - :param name: Name of the configuration parameter. - :type name: str - :param value: Value of the configuration parameter. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationParameter, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class ConfigurationSetting(msrest.serialization.Model): - """Configuration setting of LCM (Local Configuration Manager). - - :param configuration_mode: Specifies how the LCM(Local Configuration Manager) actually applies - the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and - ApplyAndAutoCorrect. Possible values include: "ApplyOnly", "ApplyAndMonitor", - "ApplyAndAutoCorrect". - :type configuration_mode: str or ~azure.mgmt.guestconfig.models.ConfigurationMode - :param allow_module_overwrite: If true - new configurations downloaded from the pull service - are allowed to overwrite the old ones on the target node. Otherwise, false. - :type allow_module_overwrite: bool - :param action_after_reboot: Specifies what happens after a reboot during the application of a - configuration. The possible values are ContinueConfiguration and StopConfiguration. Possible - values include: "ContinueConfiguration", "StopConfiguration". - :type action_after_reboot: str or ~azure.mgmt.guestconfig.models.ActionAfterReboot - :param refresh_frequency_mins: The time interval, in minutes, at which the LCM checks a pull - service to get updated configurations. This value is ignored if the LCM is not configured in - pull mode. The default value is 30. - :type refresh_frequency_mins: float - :param reboot_if_needed: Set this to true to automatically reboot the node after a - configuration that requires reboot is applied. Otherwise, you will have to manually reboot the - node for any configuration that requires it. The default value is false. To use this setting - when a reboot condition is enacted by something other than DSC (such as Windows Installer), - combine this setting with the xPendingReboot module. - :type reboot_if_needed: bool - :param configuration_mode_frequency_mins: How often, in minutes, the current configuration is - checked and applied. This property is ignored if the ConfigurationMode property is set to - ApplyOnly. The default value is 15. - :type configuration_mode_frequency_mins: float - """ - - _attribute_map = { - 'configuration_mode': {'key': 'configurationMode', 'type': 'str'}, - 'allow_module_overwrite': {'key': 'allowModuleOverwrite', 'type': 'bool'}, - 'action_after_reboot': {'key': 'actionAfterReboot', 'type': 'str'}, - 'refresh_frequency_mins': {'key': 'refreshFrequencyMins', 'type': 'float'}, - 'reboot_if_needed': {'key': 'rebootIfNeeded', 'type': 'bool'}, - 'configuration_mode_frequency_mins': {'key': 'configurationModeFrequencyMins', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationSetting, self).__init__(**kwargs) - self.configuration_mode = kwargs.get('configuration_mode', None) - self.allow_module_overwrite = kwargs.get('allow_module_overwrite', None) - self.action_after_reboot = kwargs.get('action_after_reboot', None) - self.refresh_frequency_mins = kwargs.get('refresh_frequency_mins', 30) - self.reboot_if_needed = kwargs.get('reboot_if_needed', None) - self.configuration_mode_frequency_mins = kwargs.get('configuration_mode_frequency_mins', 15) - - -class ErrorResponse(msrest.serialization.Model): - """Error response of an operation failure. - - :param error: - :type error: ~azure.mgmt.guestconfig.models.ErrorResponseError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseError(msrest.serialization.Model): - """ErrorResponseError. - - :param code: Error code. - :type code: str - :param message: Detail error message indicating why the operation failed. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ARM resource id of the guest configuration assignment. - :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = kwargs.get('name', None) - self.location = kwargs.get('location', None) - self.type = None - - -class ProxyResource(Resource): - """ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ARM resource id of the guest configuration assignment. - :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class GuestConfigurationAssignment(ProxyResource): - """Guest configuration assignment is an association between a machine and guest configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ARM resource id of the guest configuration assignment. - :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str - :ivar type: The type of the resource. - :vartype type: str - :param properties: Properties of the Guest configuration assignment. - :type properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'GuestConfigurationAssignmentProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignment, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class GuestConfigurationAssignmentList(msrest.serialization.Model): - """The response of the list guest configuration assignment operation. - - :param value: Result of the list guest configuration assignment operation. - :type value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignment] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GuestConfigurationAssignment]'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignmentList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class GuestConfigurationAssignmentProperties(msrest.serialization.Model): - """Guest configuration assignment properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_resource_id: VM resource Id. - :vartype target_resource_id: str - :param guest_configuration: The guest configuration to assign. - :type guest_configuration: ~azure.mgmt.guestconfig.models.GuestConfigurationNavigation - :ivar compliance_status: A value indicating compliance status of the machine for the assigned - guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". - :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus - :ivar last_compliance_status_checked: Date and time when last compliance status was checked. - :vartype last_compliance_status_checked: ~datetime.datetime - :ivar latest_report_id: Id of the latest report for the guest configuration assignment. - :vartype latest_report_id: str - :param latest_assignment_report: Last reported guest configuration assignment report. - :type latest_assignment_report: ~azure.mgmt.guestconfig.models.AssignmentReport - :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. - :type context: str - :ivar assignment_hash: Combined hash of the configuration package and parameters. - :vartype assignment_hash: str - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "Succeeded", "Failed", "Canceled", "Created". - :vartype provisioning_state: str or ~azure.mgmt.guestconfig.models.ProvisioningState - """ - - _validation = { - 'target_resource_id': {'readonly': True}, - 'compliance_status': {'readonly': True}, - 'last_compliance_status_checked': {'readonly': True}, - 'latest_report_id': {'readonly': True}, - 'assignment_hash': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, - 'guest_configuration': {'key': 'guestConfiguration', 'type': 'GuestConfigurationNavigation'}, - 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, - 'last_compliance_status_checked': {'key': 'lastComplianceStatusChecked', 'type': 'iso-8601'}, - 'latest_report_id': {'key': 'latestReportId', 'type': 'str'}, - 'latest_assignment_report': {'key': 'latestAssignmentReport', 'type': 'AssignmentReport'}, - 'context': {'key': 'context', 'type': 'str'}, - 'assignment_hash': {'key': 'assignmentHash', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignmentProperties, self).__init__(**kwargs) - self.target_resource_id = None - self.guest_configuration = kwargs.get('guest_configuration', None) - self.compliance_status = None - self.last_compliance_status_checked = None - self.latest_report_id = None - self.latest_assignment_report = kwargs.get('latest_assignment_report', None) - self.context = kwargs.get('context', None) - self.assignment_hash = None - self.provisioning_state = None - - -class GuestConfigurationAssignmentReport(msrest.serialization.Model): - """Report for the guest configuration assignment. Report contains information such as compliance status, reason, and more. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ARM resource id of the report for the guest configuration assignment. - :vartype id: str - :ivar name: GUID that identifies the guest configuration assignment report under a - subscription, resource group. - :vartype name: str - :param properties: Properties of the guest configuration report. - :type properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'GuestConfigurationAssignmentReportProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignmentReport, self).__init__(**kwargs) - self.id = None - self.name = None - self.properties = kwargs.get('properties', None) - - -class GuestConfigurationAssignmentReportList(msrest.serialization.Model): - """List of guest configuration assignment reports. - - :param value: List of reports for the guest configuration. Report contains information such as - compliance status, reason and more. - :type value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GuestConfigurationAssignmentReport]'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignmentReportList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class GuestConfigurationAssignmentReportProperties(msrest.serialization.Model): - """Report for the guest configuration assignment. Report contains information such as compliance status, reason, and more. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_status: A value indicating compliance status of the machine for the assigned - guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". - :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus - :ivar report_id: GUID that identifies the guest configuration assignment report under a - subscription, resource group. - :vartype report_id: str - :param assignment: Configuration details of the guest configuration assignment. - :type assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo - :param vm: Information about the VM. - :type vm: ~azure.mgmt.guestconfig.models.VMInfo - :ivar start_time: Start date and time of the guest configuration assignment compliance status - check. - :vartype start_time: ~datetime.datetime - :ivar end_time: End date and time of the guest configuration assignment compliance status - check. - :vartype end_time: ~datetime.datetime - :param details: Details of the assignment report. - :type details: ~azure.mgmt.guestconfig.models.AssignmentReportDetails - """ - - _validation = { - 'compliance_status': {'readonly': True}, - 'report_id': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - } - - _attribute_map = { - 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, - 'report_id': {'key': 'reportId', 'type': 'str'}, - 'assignment': {'key': 'assignment', 'type': 'AssignmentInfo'}, - 'vm': {'key': 'vm', 'type': 'VMInfo'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'details': {'key': 'details', 'type': 'AssignmentReportDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationAssignmentReportProperties, self).__init__(**kwargs) - self.compliance_status = None - self.report_id = None - self.assignment = kwargs.get('assignment', None) - self.vm = kwargs.get('vm', None) - self.start_time = None - self.end_time = None - self.details = kwargs.get('details', None) - - -class GuestConfigurationNavigation(msrest.serialization.Model): - """Guest configuration is an artifact that encapsulates DSC configuration and its dependencies. The artifact is a zip file containing DSC configuration (as MOF) and dependent resources and other dependencies like modules. - - :param kind: Kind of the guest configuration. For example:DSC. Possible values include: "DSC". - :type kind: str or ~azure.mgmt.guestconfig.models.Kind - :param name: Name of the guest configuration. - :type name: str - :param version: Version of the guest configuration. - :type version: str - :param content_uri: Uri of the storage where guest configuration package is uploaded. - :type content_uri: str - :param content_hash: Combined hash of the guest configuration package and configuration - parameters. - :type content_hash: str - :param assignment_type: Specifies the assignment type and execution of the configuration. - Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. - Possible values include: "Audit", "DeployAndAutoCorrect", "ApplyAndAutoCorrect", - "ApplyAndMonitor". - :type assignment_type: str or ~azure.mgmt.guestconfig.models.AssignmentType - :param configuration_parameter: The configuration parameters for the guest configuration. - :type configuration_parameter: list[~azure.mgmt.guestconfig.models.ConfigurationParameter] - :param configuration_setting: The configuration setting for the guest configuration. - :type configuration_setting: ~azure.mgmt.guestconfig.models.ConfigurationSetting - """ - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'content_uri': {'key': 'contentUri', 'type': 'str'}, - 'content_hash': {'key': 'contentHash', 'type': 'str'}, - 'assignment_type': {'key': 'assignmentType', 'type': 'str'}, - 'configuration_parameter': {'key': 'configurationParameter', 'type': '[ConfigurationParameter]'}, - 'configuration_setting': {'key': 'configurationSetting', 'type': 'ConfigurationSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(GuestConfigurationNavigation, self).__init__(**kwargs) - self.kind = kwargs.get('kind', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - self.content_uri = kwargs.get('content_uri', None) - self.content_hash = kwargs.get('content_hash', None) - self.assignment_type = kwargs.get('assignment_type', None) - self.configuration_parameter = kwargs.get('configuration_parameter', None) - self.configuration_setting = kwargs.get('configuration_setting', None) - - -class Operation(msrest.serialization.Model): - """GuestConfiguration REST API operation. - - :param name: Operation name: For ex. - providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read. - :type name: str - :param display: Provider, Resource, Operation and description values. - :type display: ~azure.mgmt.guestconfig.models.OperationDisplay - :param status_code: Service provider: Microsoft.GuestConfiguration. - :type status_code: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'status_code': {'key': 'properties.statusCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.status_code = kwargs.get('status_code', None) - - -class OperationDisplay(msrest.serialization.Model): - """Provider, Resource, Operation and description values. - - :param provider: Service provider: Microsoft.GuestConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed: For ex. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description about operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationList(msrest.serialization.Model): - """The response model for the list of Automation operations. - - :param value: List of Automation operations supported by the Automation resource provider. - :type value: list[~azure.mgmt.guestconfig.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class VMInfo(msrest.serialization.Model): - """Information about the VM. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id of the VM. - :vartype id: str - :ivar uuid: UUID(Universally Unique Identifier) of the VM. - :vartype uuid: str - """ - - _validation = { - 'id': {'readonly': True}, - 'uuid': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'uuid': {'key': 'uuid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMInfo, self).__init__(**kwargs) - self.id = None - self.uuid = None diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models_py3.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models_py3.py index bce6b19cdec6..bc669313b06a 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models_py3.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models_py3.py @@ -21,8 +21,8 @@ class AssignmentInfo(msrest.serialization.Model): :ivar name: Name of the guest configuration assignment. :vartype name: str - :param configuration: Information about the configuration. - :type configuration: ~azure.mgmt.guestconfig.models.ConfigurationInfo + :ivar configuration: Information about the configuration. + :vartype configuration: ~azure.mgmt.guestconfig.models.ConfigurationInfo """ _validation = { @@ -40,6 +40,10 @@ def __init__( configuration: Optional["ConfigurationInfo"] = None, **kwargs ): + """ + :keyword configuration: Information about the configuration. + :paramtype configuration: ~azure.mgmt.guestconfig.models.ConfigurationInfo + """ super(AssignmentInfo, self).__init__(**kwargs) self.name = None self.configuration = configuration @@ -55,10 +59,10 @@ class AssignmentReport(msrest.serialization.Model): :ivar report_id: GUID that identifies the guest configuration assignment report under a subscription, resource group. :vartype report_id: str - :param assignment: Configuration details of the guest configuration assignment. - :type assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo - :param vm: Information about the VM. - :type vm: ~azure.mgmt.guestconfig.models.VMInfo + :ivar assignment: Configuration details of the guest configuration assignment. + :vartype assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo + :ivar vm: Information about the VM. + :vartype vm: ~azure.mgmt.guestconfig.models.VMInfo :ivar start_time: Start date and time of the guest configuration assignment compliance status check. :vartype start_time: ~datetime.datetime @@ -71,9 +75,9 @@ class AssignmentReport(msrest.serialization.Model): :ivar operation_type: Type of report, Consistency or Initial. Possible values include: "Consistency", "Initial". :vartype operation_type: str or ~azure.mgmt.guestconfig.models.Type - :param resources: The list of resources for which guest configuration assignment compliance is + :ivar resources: The list of resources for which guest configuration assignment compliance is checked. - :type resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] + :vartype resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] """ _validation = { @@ -105,6 +109,15 @@ def __init__( resources: Optional[List["AssignmentReportResource"]] = None, **kwargs ): + """ + :keyword assignment: Configuration details of the guest configuration assignment. + :paramtype assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo + :keyword vm: Information about the VM. + :paramtype vm: ~azure.mgmt.guestconfig.models.VMInfo + :keyword resources: The list of resources for which guest configuration assignment compliance + is checked. + :paramtype resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] + """ super(AssignmentReport, self).__init__(**kwargs) self.id = None self.report_id = None @@ -136,9 +149,9 @@ class AssignmentReportDetails(msrest.serialization.Model): :ivar operation_type: Type of report, Consistency or Initial. Possible values include: "Consistency", "Initial". :vartype operation_type: str or ~azure.mgmt.guestconfig.models.Type - :param resources: The list of resources for which guest configuration assignment compliance is + :ivar resources: The list of resources for which guest configuration assignment compliance is checked. - :type resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] + :vartype resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] """ _validation = { @@ -164,6 +177,11 @@ def __init__( resources: Optional[List["AssignmentReportResource"]] = None, **kwargs ): + """ + :keyword resources: The list of resources for which guest configuration assignment compliance + is checked. + :paramtype resources: list[~azure.mgmt.guestconfig.models.AssignmentReportResource] + """ super(AssignmentReportDetails, self).__init__(**kwargs) self.compliance_status = None self.start_time = None @@ -183,8 +201,8 @@ class AssignmentReportResource(msrest.serialization.Model): :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus :ivar resource_id: Name of the guest configuration assignment resource setting. :vartype resource_id: str - :param reasons: Compliance reason and reason code for a resource. - :type reasons: list[~azure.mgmt.guestconfig.models.AssignmentReportResourceComplianceReason] + :ivar reasons: Compliance reason and reason code for a resource. + :vartype reasons: list[~azure.mgmt.guestconfig.models.AssignmentReportResourceComplianceReason] :ivar properties: Properties of a guest configuration assignment resource. :vartype properties: any """ @@ -208,6 +226,11 @@ def __init__( reasons: Optional[List["AssignmentReportResourceComplianceReason"]] = None, **kwargs ): + """ + :keyword reasons: Compliance reason and reason code for a resource. + :paramtype reasons: + list[~azure.mgmt.guestconfig.models.AssignmentReportResourceComplianceReason] + """ super(AssignmentReportResource, self).__init__(**kwargs) self.compliance_status = None self.resource_id = None @@ -240,6 +263,8 @@ def __init__( self, **kwargs ): + """ + """ super(AssignmentReportResourceComplianceReason, self).__init__(**kwargs) self.phrase = None self.code = None @@ -270,6 +295,8 @@ def __init__( self, **kwargs ): + """ + """ super(ConfigurationInfo, self).__init__(**kwargs) self.name = None self.version = None @@ -278,10 +305,10 @@ def __init__( class ConfigurationParameter(msrest.serialization.Model): """Represents a configuration parameter. - :param name: Name of the configuration parameter. - :type name: str - :param value: Value of the configuration parameter. - :type value: str + :ivar name: Name of the configuration parameter. + :vartype name: str + :ivar value: Value of the configuration parameter. + :vartype value: str """ _attribute_map = { @@ -296,6 +323,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the configuration parameter. + :paramtype name: str + :keyword value: Value of the configuration parameter. + :paramtype value: str + """ super(ConfigurationParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -304,32 +337,32 @@ def __init__( class ConfigurationSetting(msrest.serialization.Model): """Configuration setting of LCM (Local Configuration Manager). - :param configuration_mode: Specifies how the LCM(Local Configuration Manager) actually applies + :ivar configuration_mode: Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. Possible values include: "ApplyOnly", "ApplyAndMonitor", "ApplyAndAutoCorrect". - :type configuration_mode: str or ~azure.mgmt.guestconfig.models.ConfigurationMode - :param allow_module_overwrite: If true - new configurations downloaded from the pull service - are allowed to overwrite the old ones on the target node. Otherwise, false. - :type allow_module_overwrite: bool - :param action_after_reboot: Specifies what happens after a reboot during the application of a + :vartype configuration_mode: str or ~azure.mgmt.guestconfig.models.ConfigurationMode + :ivar allow_module_overwrite: If true - new configurations downloaded from the pull service are + allowed to overwrite the old ones on the target node. Otherwise, false. + :vartype allow_module_overwrite: bool + :ivar action_after_reboot: Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration. Possible values include: "ContinueConfiguration", "StopConfiguration". - :type action_after_reboot: str or ~azure.mgmt.guestconfig.models.ActionAfterReboot - :param refresh_frequency_mins: The time interval, in minutes, at which the LCM checks a pull + :vartype action_after_reboot: str or ~azure.mgmt.guestconfig.models.ActionAfterReboot + :ivar refresh_frequency_mins: The time interval, in minutes, at which the LCM checks a pull service to get updated configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - :type refresh_frequency_mins: float - :param reboot_if_needed: Set this to true to automatically reboot the node after a - configuration that requires reboot is applied. Otherwise, you will have to manually reboot the - node for any configuration that requires it. The default value is false. To use this setting - when a reboot condition is enacted by something other than DSC (such as Windows Installer), - combine this setting with the xPendingReboot module. - :type reboot_if_needed: bool - :param configuration_mode_frequency_mins: How often, in minutes, the current configuration is + :vartype refresh_frequency_mins: float + :ivar reboot_if_needed: Set this to true to automatically reboot the node after a configuration + that requires reboot is applied. Otherwise, you will have to manually reboot the node for any + configuration that requires it. The default value is false. To use this setting when a reboot + condition is enacted by something other than DSC (such as Windows Installer), combine this + setting with the xPendingReboot module. + :vartype reboot_if_needed: bool + :ivar configuration_mode_frequency_mins: How often, in minutes, the current configuration is checked and applied. This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - :type configuration_mode_frequency_mins: float + :vartype configuration_mode_frequency_mins: float """ _attribute_map = { @@ -352,6 +385,34 @@ def __init__( configuration_mode_frequency_mins: Optional[float] = 15, **kwargs ): + """ + :keyword configuration_mode: Specifies how the LCM(Local Configuration Manager) actually + applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, + and ApplyAndAutoCorrect. Possible values include: "ApplyOnly", "ApplyAndMonitor", + "ApplyAndAutoCorrect". + :paramtype configuration_mode: str or ~azure.mgmt.guestconfig.models.ConfigurationMode + :keyword allow_module_overwrite: If true - new configurations downloaded from the pull service + are allowed to overwrite the old ones on the target node. Otherwise, false. + :paramtype allow_module_overwrite: bool + :keyword action_after_reboot: Specifies what happens after a reboot during the application of a + configuration. The possible values are ContinueConfiguration and StopConfiguration. Possible + values include: "ContinueConfiguration", "StopConfiguration". + :paramtype action_after_reboot: str or ~azure.mgmt.guestconfig.models.ActionAfterReboot + :keyword refresh_frequency_mins: The time interval, in minutes, at which the LCM checks a pull + service to get updated configurations. This value is ignored if the LCM is not configured in + pull mode. The default value is 30. + :paramtype refresh_frequency_mins: float + :keyword reboot_if_needed: Set this to true to automatically reboot the node after a + configuration that requires reboot is applied. Otherwise, you will have to manually reboot the + node for any configuration that requires it. The default value is false. To use this setting + when a reboot condition is enacted by something other than DSC (such as Windows Installer), + combine this setting with the xPendingReboot module. + :paramtype reboot_if_needed: bool + :keyword configuration_mode_frequency_mins: How often, in minutes, the current configuration is + checked and applied. This property is ignored if the ConfigurationMode property is set to + ApplyOnly. The default value is 15. + :paramtype configuration_mode_frequency_mins: float + """ super(ConfigurationSetting, self).__init__(**kwargs) self.configuration_mode = configuration_mode self.allow_module_overwrite = allow_module_overwrite @@ -364,8 +425,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error response of an operation failure. - :param error: - :type error: ~azure.mgmt.guestconfig.models.ErrorResponseError + :ivar error: + :vartype error: ~azure.mgmt.guestconfig.models.ErrorResponseError """ _attribute_map = { @@ -378,6 +439,10 @@ def __init__( error: Optional["ErrorResponseError"] = None, **kwargs ): + """ + :keyword error: + :paramtype error: ~azure.mgmt.guestconfig.models.ErrorResponseError + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -385,10 +450,10 @@ def __init__( class ErrorResponseError(msrest.serialization.Model): """ErrorResponseError. - :param code: Error code. - :type code: str - :param message: Detail error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Detail error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -403,6 +468,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Detail error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponseError, self).__init__(**kwargs) self.code = code self.message = message @@ -415,10 +486,10 @@ class Resource(msrest.serialization.Model): :ivar id: ARM resource id of the guest configuration assignment. :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str + :ivar name: Name of the guest configuration assignment. + :vartype name: str + :ivar location: Region where the VM is located. + :vartype location: str :ivar type: The type of the resource. :vartype type: str """ @@ -442,6 +513,12 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the guest configuration assignment. + :paramtype name: str + :keyword location: Region where the VM is located. + :paramtype location: str + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = name @@ -456,10 +533,10 @@ class ProxyResource(Resource): :ivar id: ARM resource id of the guest configuration assignment. :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str + :ivar name: Name of the guest configuration assignment. + :vartype name: str + :ivar location: Region where the VM is located. + :vartype location: str :ivar type: The type of the resource. :vartype type: str """ @@ -483,6 +560,12 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the guest configuration assignment. + :paramtype name: str + :keyword location: Region where the VM is located. + :paramtype location: str + """ super(ProxyResource, self).__init__(name=name, location=location, **kwargs) @@ -493,14 +576,14 @@ class GuestConfigurationAssignment(ProxyResource): :ivar id: ARM resource id of the guest configuration assignment. :vartype id: str - :param name: Name of the guest configuration assignment. - :type name: str - :param location: Region where the VM is located. - :type location: str + :ivar name: Name of the guest configuration assignment. + :vartype name: str + :ivar location: Region where the VM is located. + :vartype location: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Guest configuration assignment. - :type properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentProperties + :ivar properties: Properties of the Guest configuration assignment. + :vartype properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentProperties """ _validation = { @@ -524,6 +607,14 @@ def __init__( properties: Optional["GuestConfigurationAssignmentProperties"] = None, **kwargs ): + """ + :keyword name: Name of the guest configuration assignment. + :paramtype name: str + :keyword location: Region where the VM is located. + :paramtype location: str + :keyword properties: Properties of the Guest configuration assignment. + :paramtype properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentProperties + """ super(GuestConfigurationAssignment, self).__init__(name=name, location=location, **kwargs) self.properties = properties @@ -531,8 +622,8 @@ def __init__( class GuestConfigurationAssignmentList(msrest.serialization.Model): """The response of the list guest configuration assignment operation. - :param value: Result of the list guest configuration assignment operation. - :type value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignment] + :ivar value: Result of the list guest configuration assignment operation. + :vartype value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignment] """ _attribute_map = { @@ -545,6 +636,10 @@ def __init__( value: Optional[List["GuestConfigurationAssignment"]] = None, **kwargs ): + """ + :keyword value: Result of the list guest configuration assignment operation. + :paramtype value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignment] + """ super(GuestConfigurationAssignmentList, self).__init__(**kwargs) self.value = value @@ -556,8 +651,8 @@ class GuestConfigurationAssignmentProperties(msrest.serialization.Model): :ivar target_resource_id: VM resource Id. :vartype target_resource_id: str - :param guest_configuration: The guest configuration to assign. - :type guest_configuration: ~azure.mgmt.guestconfig.models.GuestConfigurationNavigation + :ivar guest_configuration: The guest configuration to assign. + :vartype guest_configuration: ~azure.mgmt.guestconfig.models.GuestConfigurationNavigation :ivar compliance_status: A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus @@ -565,11 +660,16 @@ class GuestConfigurationAssignmentProperties(msrest.serialization.Model): :vartype last_compliance_status_checked: ~datetime.datetime :ivar latest_report_id: Id of the latest report for the guest configuration assignment. :vartype latest_report_id: str - :param latest_assignment_report: Last reported guest configuration assignment report. - :type latest_assignment_report: ~azure.mgmt.guestconfig.models.AssignmentReport - :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. - :type context: str + :ivar parameter_hash: parameter hash for the guest configuration assignment. + :vartype parameter_hash: str + :ivar resource_type: Type of the resource - VMSS / VM. + :vartype resource_type: str + :ivar vmss_vm_list: The list of VM Compliance data for VMSS. + :vartype vmss_vm_list: list[~azure.mgmt.guestconfig.models.VMSSVMInfo] + :ivar latest_assignment_report: Last reported guest configuration assignment report. + :vartype latest_assignment_report: ~azure.mgmt.guestconfig.models.AssignmentReport + :ivar context: The source which initiated the guest configuration assignment. Ex: Azure Policy. + :vartype context: str :ivar assignment_hash: Combined hash of the configuration package and parameters. :vartype assignment_hash: str :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -582,6 +682,8 @@ class GuestConfigurationAssignmentProperties(msrest.serialization.Model): 'compliance_status': {'readonly': True}, 'last_compliance_status_checked': {'readonly': True}, 'latest_report_id': {'readonly': True}, + 'parameter_hash': {'readonly': True}, + 'resource_type': {'readonly': True}, 'assignment_hash': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -592,6 +694,9 @@ class GuestConfigurationAssignmentProperties(msrest.serialization.Model): 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, 'last_compliance_status_checked': {'key': 'lastComplianceStatusChecked', 'type': 'iso-8601'}, 'latest_report_id': {'key': 'latestReportId', 'type': 'str'}, + 'parameter_hash': {'key': 'parameterHash', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'vmss_vm_list': {'key': 'vmssVMList', 'type': '[VMSSVMInfo]'}, 'latest_assignment_report': {'key': 'latestAssignmentReport', 'type': 'AssignmentReport'}, 'context': {'key': 'context', 'type': 'str'}, 'assignment_hash': {'key': 'assignmentHash', 'type': 'str'}, @@ -602,16 +707,31 @@ def __init__( self, *, guest_configuration: Optional["GuestConfigurationNavigation"] = None, + vmss_vm_list: Optional[List["VMSSVMInfo"]] = None, latest_assignment_report: Optional["AssignmentReport"] = None, context: Optional[str] = None, **kwargs ): + """ + :keyword guest_configuration: The guest configuration to assign. + :paramtype guest_configuration: ~azure.mgmt.guestconfig.models.GuestConfigurationNavigation + :keyword vmss_vm_list: The list of VM Compliance data for VMSS. + :paramtype vmss_vm_list: list[~azure.mgmt.guestconfig.models.VMSSVMInfo] + :keyword latest_assignment_report: Last reported guest configuration assignment report. + :paramtype latest_assignment_report: ~azure.mgmt.guestconfig.models.AssignmentReport + :keyword context: The source which initiated the guest configuration assignment. Ex: Azure + Policy. + :paramtype context: str + """ super(GuestConfigurationAssignmentProperties, self).__init__(**kwargs) self.target_resource_id = None self.guest_configuration = guest_configuration self.compliance_status = None self.last_compliance_status_checked = None self.latest_report_id = None + self.parameter_hash = None + self.resource_type = None + self.vmss_vm_list = vmss_vm_list self.latest_assignment_report = latest_assignment_report self.context = context self.assignment_hash = None @@ -628,8 +748,9 @@ class GuestConfigurationAssignmentReport(msrest.serialization.Model): :ivar name: GUID that identifies the guest configuration assignment report under a subscription, resource group. :vartype name: str - :param properties: Properties of the guest configuration report. - :type properties: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportProperties + :ivar properties: Properties of the guest configuration report. + :vartype properties: + ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportProperties """ _validation = { @@ -649,6 +770,11 @@ def __init__( properties: Optional["GuestConfigurationAssignmentReportProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the guest configuration report. + :paramtype properties: + ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportProperties + """ super(GuestConfigurationAssignmentReport, self).__init__(**kwargs) self.id = None self.name = None @@ -658,9 +784,9 @@ def __init__( class GuestConfigurationAssignmentReportList(msrest.serialization.Model): """List of guest configuration assignment reports. - :param value: List of reports for the guest configuration. Report contains information such as + :ivar value: List of reports for the guest configuration. Report contains information such as compliance status, reason and more. - :type value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport] + :vartype value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport] """ _attribute_map = { @@ -673,6 +799,11 @@ def __init__( value: Optional[List["GuestConfigurationAssignmentReport"]] = None, **kwargs ): + """ + :keyword value: List of reports for the guest configuration. Report contains information such + as compliance status, reason and more. + :paramtype value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport] + """ super(GuestConfigurationAssignmentReportList, self).__init__(**kwargs) self.value = value @@ -688,18 +819,20 @@ class GuestConfigurationAssignmentReportProperties(msrest.serialization.Model): :ivar report_id: GUID that identifies the guest configuration assignment report under a subscription, resource group. :vartype report_id: str - :param assignment: Configuration details of the guest configuration assignment. - :type assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo - :param vm: Information about the VM. - :type vm: ~azure.mgmt.guestconfig.models.VMInfo + :ivar assignment: Configuration details of the guest configuration assignment. + :vartype assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo + :ivar vm: Information about the VM. + :vartype vm: ~azure.mgmt.guestconfig.models.VMInfo :ivar start_time: Start date and time of the guest configuration assignment compliance status check. :vartype start_time: ~datetime.datetime :ivar end_time: End date and time of the guest configuration assignment compliance status check. :vartype end_time: ~datetime.datetime - :param details: Details of the assignment report. - :type details: ~azure.mgmt.guestconfig.models.AssignmentReportDetails + :ivar details: Details of the assignment report. + :vartype details: ~azure.mgmt.guestconfig.models.AssignmentReportDetails + :ivar vmss_resource_id: Azure resource Id of the VMSS. + :vartype vmss_resource_id: str """ _validation = { @@ -707,6 +840,7 @@ class GuestConfigurationAssignmentReportProperties(msrest.serialization.Model): 'report_id': {'readonly': True}, 'start_time': {'readonly': True}, 'end_time': {'readonly': True}, + 'vmss_resource_id': {'readonly': True}, } _attribute_map = { @@ -717,6 +851,7 @@ class GuestConfigurationAssignmentReportProperties(msrest.serialization.Model): 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'details': {'key': 'details', 'type': 'AssignmentReportDetails'}, + 'vmss_resource_id': {'key': 'vmssResourceId', 'type': 'str'}, } def __init__( @@ -727,6 +862,14 @@ def __init__( details: Optional["AssignmentReportDetails"] = None, **kwargs ): + """ + :keyword assignment: Configuration details of the guest configuration assignment. + :paramtype assignment: ~azure.mgmt.guestconfig.models.AssignmentInfo + :keyword vm: Information about the VM. + :paramtype vm: ~azure.mgmt.guestconfig.models.VMInfo + :keyword details: Details of the assignment report. + :paramtype details: ~azure.mgmt.guestconfig.models.AssignmentReportDetails + """ super(GuestConfigurationAssignmentReportProperties, self).__init__(**kwargs) self.compliance_status = None self.report_id = None @@ -735,33 +878,47 @@ def __init__( self.start_time = None self.end_time = None self.details = details + self.vmss_resource_id = None class GuestConfigurationNavigation(msrest.serialization.Model): """Guest configuration is an artifact that encapsulates DSC configuration and its dependencies. The artifact is a zip file containing DSC configuration (as MOF) and dependent resources and other dependencies like modules. - :param kind: Kind of the guest configuration. For example:DSC. Possible values include: "DSC". - :type kind: str or ~azure.mgmt.guestconfig.models.Kind - :param name: Name of the guest configuration. - :type name: str - :param version: Version of the guest configuration. - :type version: str - :param content_uri: Uri of the storage where guest configuration package is uploaded. - :type content_uri: str - :param content_hash: Combined hash of the guest configuration package and configuration + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kind: Kind of the guest configuration. For example:DSC. Possible values include: "DSC". + :vartype kind: str or ~azure.mgmt.guestconfig.models.Kind + :ivar name: Name of the guest configuration. + :vartype name: str + :ivar version: Version of the guest configuration. + :vartype version: str + :ivar content_uri: Uri of the storage where guest configuration package is uploaded. + :vartype content_uri: str + :ivar content_hash: Combined hash of the guest configuration package and configuration parameters. - :type content_hash: str - :param assignment_type: Specifies the assignment type and execution of the configuration. + :vartype content_hash: str + :ivar assignment_type: Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. Possible values include: "Audit", "DeployAndAutoCorrect", "ApplyAndAutoCorrect", "ApplyAndMonitor". - :type assignment_type: str or ~azure.mgmt.guestconfig.models.AssignmentType - :param configuration_parameter: The configuration parameters for the guest configuration. - :type configuration_parameter: list[~azure.mgmt.guestconfig.models.ConfigurationParameter] - :param configuration_setting: The configuration setting for the guest configuration. - :type configuration_setting: ~azure.mgmt.guestconfig.models.ConfigurationSetting + :vartype assignment_type: str or ~azure.mgmt.guestconfig.models.AssignmentType + :ivar content_type: Specifies the content type of the configuration. Possible values could be + Builtin or Custom. + :vartype content_type: str + :ivar configuration_parameter: The configuration parameters for the guest configuration. + :vartype configuration_parameter: list[~azure.mgmt.guestconfig.models.ConfigurationParameter] + :ivar configuration_protected_parameter: The protected configuration parameters for the guest + configuration. + :vartype configuration_protected_parameter: + list[~azure.mgmt.guestconfig.models.ConfigurationParameter] + :ivar configuration_setting: The configuration setting for the guest configuration. + :vartype configuration_setting: ~azure.mgmt.guestconfig.models.ConfigurationSetting """ + _validation = { + 'content_type': {'readonly': True}, + } + _attribute_map = { 'kind': {'key': 'kind', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, @@ -769,7 +926,9 @@ class GuestConfigurationNavigation(msrest.serialization.Model): 'content_uri': {'key': 'contentUri', 'type': 'str'}, 'content_hash': {'key': 'contentHash', 'type': 'str'}, 'assignment_type': {'key': 'assignmentType', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, 'configuration_parameter': {'key': 'configurationParameter', 'type': '[ConfigurationParameter]'}, + 'configuration_protected_parameter': {'key': 'configurationProtectedParameter', 'type': '[ConfigurationParameter]'}, 'configuration_setting': {'key': 'configurationSetting', 'type': 'ConfigurationSetting'}, } @@ -783,9 +942,37 @@ def __init__( content_hash: Optional[str] = None, assignment_type: Optional[Union[str, "AssignmentType"]] = None, configuration_parameter: Optional[List["ConfigurationParameter"]] = None, + configuration_protected_parameter: Optional[List["ConfigurationParameter"]] = None, configuration_setting: Optional["ConfigurationSetting"] = None, **kwargs ): + """ + :keyword kind: Kind of the guest configuration. For example:DSC. Possible values include: + "DSC". + :paramtype kind: str or ~azure.mgmt.guestconfig.models.Kind + :keyword name: Name of the guest configuration. + :paramtype name: str + :keyword version: Version of the guest configuration. + :paramtype version: str + :keyword content_uri: Uri of the storage where guest configuration package is uploaded. + :paramtype content_uri: str + :keyword content_hash: Combined hash of the guest configuration package and configuration + parameters. + :paramtype content_hash: str + :keyword assignment_type: Specifies the assignment type and execution of the configuration. + Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. + Possible values include: "Audit", "DeployAndAutoCorrect", "ApplyAndAutoCorrect", + "ApplyAndMonitor". + :paramtype assignment_type: str or ~azure.mgmt.guestconfig.models.AssignmentType + :keyword configuration_parameter: The configuration parameters for the guest configuration. + :paramtype configuration_parameter: list[~azure.mgmt.guestconfig.models.ConfigurationParameter] + :keyword configuration_protected_parameter: The protected configuration parameters for the + guest configuration. + :paramtype configuration_protected_parameter: + list[~azure.mgmt.guestconfig.models.ConfigurationParameter] + :keyword configuration_setting: The configuration setting for the guest configuration. + :paramtype configuration_setting: ~azure.mgmt.guestconfig.models.ConfigurationSetting + """ super(GuestConfigurationNavigation, self).__init__(**kwargs) self.kind = kind self.name = name @@ -793,20 +980,22 @@ def __init__( self.content_uri = content_uri self.content_hash = content_hash self.assignment_type = assignment_type + self.content_type = None self.configuration_parameter = configuration_parameter + self.configuration_protected_parameter = configuration_protected_parameter self.configuration_setting = configuration_setting class Operation(msrest.serialization.Model): """GuestConfiguration REST API operation. - :param name: Operation name: For ex. + :ivar name: Operation name: For ex. providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read. - :type name: str - :param display: Provider, Resource, Operation and description values. - :type display: ~azure.mgmt.guestconfig.models.OperationDisplay - :param status_code: Service provider: Microsoft.GuestConfiguration. - :type status_code: str + :vartype name: str + :ivar display: Provider, Resource, Operation and description values. + :vartype display: ~azure.mgmt.guestconfig.models.OperationDisplay + :ivar status_code: Service provider: Microsoft.GuestConfiguration. + :vartype status_code: str """ _attribute_map = { @@ -823,6 +1012,15 @@ def __init__( status_code: Optional[str] = None, **kwargs ): + """ + :keyword name: Operation name: For ex. + providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read. + :paramtype name: str + :keyword display: Provider, Resource, Operation and description values. + :paramtype display: ~azure.mgmt.guestconfig.models.OperationDisplay + :keyword status_code: Service provider: Microsoft.GuestConfiguration. + :paramtype status_code: str + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -832,14 +1030,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Provider, Resource, Operation and description values. - :param provider: Service provider: Microsoft.GuestConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed: For ex. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description about operation. - :type description: str + :ivar provider: Service provider: Microsoft.GuestConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: For ex. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description about operation. + :vartype description: str """ _attribute_map = { @@ -858,6 +1056,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft.GuestConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: For ex. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword description: Description about operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -868,8 +1076,8 @@ def __init__( class OperationList(msrest.serialization.Model): """The response model for the list of Automation operations. - :param value: List of Automation operations supported by the Automation resource provider. - :type value: list[~azure.mgmt.guestconfig.models.Operation] + :ivar value: List of Automation operations supported by the Automation resource provider. + :vartype value: list[~azure.mgmt.guestconfig.models.Operation] """ _attribute_map = { @@ -882,6 +1090,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Automation operations supported by the Automation resource provider. + :paramtype value: list[~azure.mgmt.guestconfig.models.Operation] + """ super(OperationList, self).__init__(**kwargs) self.value = value @@ -911,6 +1123,56 @@ def __init__( self, **kwargs ): + """ + """ super(VMInfo, self).__init__(**kwargs) self.id = None self.uuid = None + + +class VMSSVMInfo(msrest.serialization.Model): + """Information about VMSS VM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_id: UUID of the VM. + :vartype vm_id: str + :ivar vm_resource_id: Azure resource Id of the VM. + :vartype vm_resource_id: str + :ivar compliance_status: A value indicating compliance status of the machine for the assigned + guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". + :vartype compliance_status: str or ~azure.mgmt.guestconfig.models.ComplianceStatus + :ivar latest_report_id: Id of the latest report for the guest configuration assignment. + :vartype latest_report_id: str + :ivar last_compliance_checked: Date and time when last compliance status was checked. + :vartype last_compliance_checked: ~datetime.datetime + """ + + _validation = { + 'vm_id': {'readonly': True}, + 'vm_resource_id': {'readonly': True}, + 'compliance_status': {'readonly': True}, + 'latest_report_id': {'readonly': True}, + 'last_compliance_checked': {'readonly': True}, + } + + _attribute_map = { + 'vm_id': {'key': 'vmId', 'type': 'str'}, + 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, + 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, + 'latest_report_id': {'key': 'latestReportId', 'type': 'str'}, + 'last_compliance_checked': {'key': 'lastComplianceChecked', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VMSSVMInfo, self).__init__(**kwargs) + self.vm_id = None + self.vm_resource_id = None + self.compliance_status = None + self.latest_report_id = None + self.last_compliance_checked = None diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_operations.py index fcd6da97a0c6..d95e4b7e966c 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_operations.py @@ -5,22 +5,100 @@ # 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, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + vm_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_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( + resource_group_name: str, + guest_configuration_assignment_name: str, + report_id: str, + subscription_id: str, + vm_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "reportId": _SERIALIZER.url("report_id", report_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_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 + ) class GuestConfigurationAssignmentReportsOperations(object): """GuestConfigurationAssignmentReportsOperations operations. @@ -44,14 +122,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignmentReportList" + resource_group_name: str, + guest_configuration_assignment_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReportList": """List all reports for the guest configuration assignment, latest report first. :param resource_group_name: The resource group name. @@ -70,34 +148,24 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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 = build_list_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReportList', pipeline_response) @@ -106,17 +174,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - report_id, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignmentReport" + resource_group_name: str, + guest_configuration_assignment_name: str, + report_id: str, + vm_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReport": """Get a report for the guest configuration assignment, by reportId. :param resource_group_name: The resource group name. @@ -137,35 +207,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'reportId': self._serialize.url("report_id", report_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + report_id=report_id, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) @@ -174,4 +234,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_operations.py index f518307777cd..bd281d5216d6 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_operations.py @@ -5,23 +5,245 @@ # 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 msrest import Serializer from .. import models as _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 .._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_create_or_update_request( + guest_configuration_assignment_name: str, + subscription_id: str, + resource_group_name: str, + vm_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "vmName": _SERIALIZER.url("vm_name", vm_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_get_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + vm_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_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_delete_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + vm_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_subscription_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments') + 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_rg_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "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_request( + resource_group_name: str, + subscription_id: str, + vm_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_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 + ) class GuestConfigurationAssignmentsOperations(object): """GuestConfigurationAssignmentsOperations operations. @@ -45,15 +267,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - guest_configuration_assignment_name, # type: str - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.GuestConfigurationAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignment" + guest_configuration_assignment_name: str, + resource_group_name: str, + vm_name: str, + parameters: "_models.GuestConfigurationAssignment", + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": """Creates an association between a VM and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -74,39 +296,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'vmName': self._serialize.url("vm_name", vm_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(parameters, 'GuestConfigurationAssignment') + + request = build_create_or_update_request( + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vm_name=vm_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(parameters, 'GuestConfigurationAssignment') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -119,16 +331,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignment" + resource_group_name: str, + guest_configuration_assignment_name: str, + vm_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": """Get information about a guest configuration assignment. :param resource_group_name: The resource group name. @@ -147,34 +361,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -183,16 +387,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + guest_configuration_assignment_name: str, + vm_name: str, + **kwargs: Any + ) -> None: """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -211,34 +417,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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_delete_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -246,13 +442,151 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace + def subscription_list( + self, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_subscription_list_request( + subscription_id=self._config.subscription_id, + template_url=self.subscription_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_subscription_list_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("GuestConfigurationAssignmentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + subscription_list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + + @distributed_trace + def rg_list( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for a 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 GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_rg_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.rg_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_rg_list_request( + resource_group_name=resource_group_name, + 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("GuestConfigurationAssignmentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + rg_list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vm_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GuestConfigurationAssignmentList"] + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentList"]: """List all guest configuration assignments for a virtual machine. :param resource_group_name: The resource group name. @@ -260,8 +594,10 @@ def list( :param vm_name: The name of the virtual machine. :type vm_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] @@ -269,36 +605,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vmName': self._serialize.url("vm_name", vm_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_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vm_name=vm_name, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vm_name=vm_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('GuestConfigurationAssignmentList', pipeline_response) + deserialized = self._deserialize("GuestConfigurationAssignmentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -311,12 +644,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignment_reports_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignment_reports_operations.py index 0a6ae622a3b6..4ec5c1f5f51a 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignment_reports_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignment_reports_operations.py @@ -5,22 +5,100 @@ # 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, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + machine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "machineName": _SERIALIZER.url("machine_name", machine_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( + resource_group_name: str, + guest_configuration_assignment_name: str, + report_id: str, + subscription_id: str, + machine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "reportId": _SERIALIZER.url("report_id", report_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "machineName": _SERIALIZER.url("machine_name", machine_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 + ) class GuestConfigurationHCRPAssignmentReportsOperations(object): """GuestConfigurationHCRPAssignmentReportsOperations operations. @@ -44,14 +122,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignmentReportList" + resource_group_name: str, + guest_configuration_assignment_name: str, + machine_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReportList": """List all reports for the guest configuration assignment, latest report first. :param resource_group_name: The resource group name. @@ -70,34 +148,24 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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 = build_list_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReportList', pipeline_response) @@ -106,17 +174,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - report_id, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignmentReport" + resource_group_name: str, + guest_configuration_assignment_name: str, + report_id: str, + machine_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReport": """Get a report for the guest configuration assignment, by reportId. :param resource_group_name: The resource group name. @@ -137,35 +207,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'reportId': self._serialize.url("report_id", report_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + report_id=report_id, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) @@ -174,4 +234,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignments_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignments_operations.py index a50b5cd21b17..b9895625f52a 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignments_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_hcrp_assignments_operations.py @@ -5,23 +5,181 @@ # 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 msrest import Serializer from .. import models as _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 .._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_create_or_update_request( + guest_configuration_assignment_name: str, + subscription_id: str, + resource_group_name: str, + machine_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "machineName": _SERIALIZER.url("machine_name", machine_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_get_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + machine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "machineName": _SERIALIZER.url("machine_name", machine_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_delete_request( + resource_group_name: str, + guest_configuration_assignment_name: str, + subscription_id: str, + machine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "guestConfigurationAssignmentName": _SERIALIZER.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "machineName": _SERIALIZER.url("machine_name", machine_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + machine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "machineName": _SERIALIZER.url("machine_name", machine_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 + ) class GuestConfigurationHCRPAssignmentsOperations(object): """GuestConfigurationHCRPAssignmentsOperations operations. @@ -45,15 +203,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - guest_configuration_assignment_name, # type: str - resource_group_name, # type: str - machine_name, # type: str - parameters, # type: "_models.GuestConfigurationAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignment" + guest_configuration_assignment_name: str, + resource_group_name: str, + machine_name: str, + parameters: "_models.GuestConfigurationAssignment", + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": """Creates an association between a ARC machine and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -74,39 +232,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'machineName': self._serialize.url("machine_name", machine_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(parameters, 'GuestConfigurationAssignment') + + request = build_create_or_update_request( + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + machine_name=machine_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(parameters, 'GuestConfigurationAssignment') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -119,16 +267,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GuestConfigurationAssignment" + resource_group_name: str, + guest_configuration_assignment_name: str, + machine_name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": """Get information about a guest configuration assignment. :param resource_group_name: The resource group name. @@ -147,34 +297,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -183,16 +323,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - guest_configuration_assignment_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + guest_configuration_assignment_name: str, + machine_name: str, + **kwargs: Any + ) -> None: """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -211,34 +353,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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_delete_request( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -246,13 +378,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GuestConfigurationAssignmentList"] + resource_group_name: str, + machine_name: str, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentList"]: """List all guest configuration assignments for an ARC machine. :param resource_group_name: The resource group name. @@ -260,8 +393,10 @@ def list( :param machine_name: The name of the ARC machine. :type machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] + :return: An iterator like instance of either GuestConfigurationAssignmentList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] @@ -269,36 +404,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'machineName': self._serialize.url("machine_name", machine_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_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + machine_name=machine_name, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + machine_name=machine_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('GuestConfigurationAssignmentList', pipeline_response) + deserialized = self._deserialize("GuestConfigurationAssignmentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -311,12 +443,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_operations.py index 13554fcf0736..95606227860a 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_operations.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_operations.py @@ -5,23 +5,50 @@ # 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 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 msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.GuestConfiguration/operations') + + # 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 + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Lists all of the available GuestConfiguration REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-25" - accept = "application/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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + 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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +122,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/_meta.json b/sdk/machinelearning/azure-mgmt-machinelearningcompute/_meta.json index f095077255d3..cad0e21753e1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/_meta.json +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.4.2", - "use": "@autorest/python@5.6.6", - "commit": "3f1d9a2fd7d79c0e10cca4a4750a00e725ddc541", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d6191d641c750189751bde4466749fa589265abc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/machinelearningcompute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.4.2", + "autorest_command": "autorest specification/machinelearningcompute/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/machinelearningcompute/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/__init__.py index bec3f4cbfb1a..b8a6ac22df5c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['MachineLearningComputeManagementClient'] -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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_configuration.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_configuration.py index 36b0434fd671..4fb4facef752 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_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 MachineLearningComputeManagementClientConfiguration(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(MachineLearningComputeManagementClientConfiguration, 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(MachineLearningComputeManagementClientConfiguration, 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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_machine_learning_compute_management_client.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_machine_learning_compute_management_client.py index 26ce93371533..181b40f8a251 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_machine_learning_compute_management_client.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_machine_learning_compute_management_client.py @@ -6,79 +6,83 @@ # 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 MachineLearningComputeManagementClientConfiguration +from .operations import MachineLearningComputeOperations, OperationalizationClustersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import MachineLearningComputeManagementClientConfiguration -from .operations import OperationalizationClustersOperations -from .operations import MachineLearningComputeOperations -from . import models - -class MachineLearningComputeManagementClient(object): +class MachineLearningComputeManagementClient: """These APIs allow end users to operate on Azure Machine Learning Compute resources. They support the following operations::code:`
  • Create or update a cluster
  • Get a cluster
  • Patch a cluster
  • Delete a cluster
  • Get keys for a cluster
  • Check if updates are available for system services in a cluster
  • Update system services in a cluster
  • Get all clusters in a resource group
  • Get all clusters in a subscription
`. :ivar operationalization_clusters: OperationalizationClustersOperations operations - :vartype operationalization_clusters: azure.mgmt.machinelearningcompute.operations.OperationalizationClustersOperations + :vartype operationalization_clusters: + azure.mgmt.machinelearningcompute.operations.OperationalizationClustersOperations :ivar machine_learning_compute: MachineLearningComputeOperations operations - :vartype machine_learning_compute: azure.mgmt.machinelearningcompute.operations.MachineLearningComputeOperations + :vartype machine_learning_compute: + azure.mgmt.machinelearningcompute.operations.MachineLearningComputeOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Azure 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 = MachineLearningComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = MachineLearningComputeManagementClientConfiguration(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.operationalization_clusters = OperationalizationClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.machine_learning_compute = MachineLearningComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.operationalization_clusters = OperationalizationClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.machine_learning_compute = MachineLearningComputeOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_metadata.json b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_metadata.json index a3f3617969cd..a1c0d04853f8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_metadata.json +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_metadata.json @@ -5,13 +5,13 @@ "name": "MachineLearningComputeManagementClient", "filename": "_machine_learning_compute_management_client", "description": "These APIs allow end users to operate on Azure Machine Learning Compute resources. They support the following operations::code:`\u003cul\u003e\u003cli\u003eCreate or update a cluster\u003c/li\u003e\u003cli\u003eGet a cluster\u003c/li\u003e\u003cli\u003ePatch a cluster\u003c/li\u003e\u003cli\u003eDelete a cluster\u003c/li\u003e\u003cli\u003eGet keys for a cluster\u003c/li\u003e\u003cli\u003eCheck if updates are available for system services in a cluster\u003c/li\u003e\u003cli\u003eUpdate system services in a cluster\u003c/li\u003e\u003cli\u003eGet all clusters in a resource group\u003c/li\u003e\u003cli\u003eGet all clusters in a subscription\u003c/li\u003e\u003c/ul\u003e`.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"MachineLearningComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MachineLearningComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"MachineLearningComputeManagementClientConfiguration\"]}}, \"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\": [\"MachineLearningComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "operationalization_clusters": "OperationalizationClustersOperations", diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_patch.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_vendor.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/_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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/__init__.py index 88188e3f0f13..03f4ea764c97 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/__init__.py @@ -8,3 +8,8 @@ from ._machine_learning_compute_management_client import MachineLearningComputeManagementClient __all__ = ['MachineLearningComputeManagementClient'] + +# `._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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_configuration.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_configuration.py index daa78697b7e1..19796986a48e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/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(MachineLearningComputeManagementClientConfiguration, 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(MachineLearningComputeManagementClientConfiguration, 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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_machine_learning_compute_management_client.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_machine_learning_compute_management_client.py index 23afab1904de..aecbb726151d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_machine_learning_compute_management_client.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_machine_learning_compute_management_client.py @@ -6,75 +6,83 @@ # 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.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import MachineLearningComputeManagementClientConfiguration +from .operations import MachineLearningComputeOperations, OperationalizationClustersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MachineLearningComputeManagementClientConfiguration -from .operations import OperationalizationClustersOperations -from .operations import MachineLearningComputeOperations -from .. import models - - -class MachineLearningComputeManagementClient(object): +class MachineLearningComputeManagementClient: """These APIs allow end users to operate on Azure Machine Learning Compute resources. They support the following operations::code:`
  • Create or update a cluster
  • Get a cluster
  • Patch a cluster
  • Delete a cluster
  • Get keys for a cluster
  • Check if updates are available for system services in a cluster
  • Update system services in a cluster
  • Get all clusters in a resource group
  • Get all clusters in a subscription
`. :ivar operationalization_clusters: OperationalizationClustersOperations operations - :vartype operationalization_clusters: azure.mgmt.machinelearningcompute.aio.operations.OperationalizationClustersOperations + :vartype operationalization_clusters: + azure.mgmt.machinelearningcompute.aio.operations.OperationalizationClustersOperations :ivar machine_learning_compute: MachineLearningComputeOperations operations - :vartype machine_learning_compute: azure.mgmt.machinelearningcompute.aio.operations.MachineLearningComputeOperations + :vartype machine_learning_compute: + azure.mgmt.machinelearningcompute.aio.operations.MachineLearningComputeOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Azure 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 = MachineLearningComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MachineLearningComputeManagementClientConfiguration(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.operationalization_clusters = OperationalizationClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.machine_learning_compute = MachineLearningComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.operationalization_clusters = OperationalizationClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.machine_learning_compute = MachineLearningComputeOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_patch.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/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/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_machine_learning_compute_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_machine_learning_compute_operations.py index 370db471f993..9ddae7c90d47 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_machine_learning_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_machine_learning_compute_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from 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_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._machine_learning_compute_operations import build_list_available_operations_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,9 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_available_operations( self, - **kwargs + **kwargs: Any ) -> "_models.AvailableOperations": """Gets all available operations. @@ -56,21 +61,14 @@ async def list_available_operations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_available_operations.metadata['url'] # type: ignore - - # 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_list_available_operations_request( + template_url=self.list_available_operations.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 @@ -84,4 +82,6 @@ async def list_available_operations( return cls(pipeline_response, deserialized, {}) return deserialized + list_available_operations.metadata = {'url': '/providers/Microsoft.MachineLearningCompute/operations'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_operationalization_clusters_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_operationalization_clusters_operations.py index da70526f4970..cde294ff7656 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_operationalization_clusters_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/aio/operations/_operationalization_clusters_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 as _models - +from ..._vendor import _convert_request +from ...operations._operationalization_clusters_operations import build_check_system_services_updates_available_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_id_request, build_list_keys_request, build_update_request, build_update_system_services_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,46 +53,35 @@ async def _create_or_update_initial( resource_group_name: str, cluster_name: str, parameters: "_models.OperationalizationCluster", - **kwargs + **kwargs: Any ) -> "_models.OperationalizationCluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationalizationCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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(parameters, 'OperationalizationCluster') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(parameters, 'OperationalizationCluster') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -99,14 +93,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, parameters: "_models.OperationalizationCluster", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.OperationalizationCluster"]: """Create or update an operationalization cluster. @@ -118,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.machinelearningcompute.models.OperationalizationCluster :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a 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. - :return: An instance of AsyncLROPoller that returns either OperationalizationCluster or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationalizationCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationalizationCluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationalizationCluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -170,13 +166,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> "_models.OperationalizationCluster": """Gets the operationalization cluster resource view. Note that the credentials are not returned by this call. Call ListKeys to get them. @@ -195,33 +193,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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, + cluster_name=cluster_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -230,14 +218,17 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, parameters: "_models.OperationalizationClusterUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.OperationalizationCluster": """The PATCH operation can be used to update only the tags for a cluster. Use PUT operation to update other properties. @@ -247,7 +238,8 @@ async def update( :param cluster_name: The name of the cluster. :type cluster_name: str :param parameters: The parameters supplied to patch the cluster. - :type parameters: ~azure.mgmt.machinelearningcompute.models.OperationalizationClusterUpdateParameters + :type parameters: + ~azure.mgmt.machinelearningcompute.models.OperationalizationClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationalizationCluster, or the result of cls(response) :rtype: ~azure.mgmt.machinelearningcompute.models.OperationalizationCluster @@ -258,38 +250,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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(parameters, 'OperationalizationClusterUpdateParameters') - # 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_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.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(parameters, 'OperationalizationClusterUpdateParameters') - 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -298,66 +280,59 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, delete_all: Optional[bool] = None, - **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 = "2017-08-01-preview" - accept = "application/json" - - # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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 delete_all is not None: - query_parameters['deleteAll'] = self._serialize.query("delete_all", delete_all, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + delete_all=delete_all, + 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 if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, delete_all: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified cluster. @@ -369,15 +344,17 @@ async def begin_delete( :type delete_all: bool :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a 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', @@ -392,21 +369,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, {}) - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -418,13 +388,15 @@ 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.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> "_models.OperationalizationClusterCredentials": """Gets the credentials for the specified cluster such as Storage, ACR and ACS credentials. This is a long running operation because it fetches keys from dependencies. @@ -443,27 +415,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_keys.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 @@ -477,13 +439,16 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/listKeys'} # type: ignore + + @distributed_trace_async async def check_system_services_updates_available( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> "_models.CheckSystemServicesUpdatesAvailableResponse": """Checks if updates are available for system services in the cluster. @@ -501,27 +466,17 @@ async def check_system_services_updates_available( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.check_system_services_updates_available.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_check_system_services_updates_available_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.check_system_services_updates_available.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 @@ -535,40 +490,32 @@ async def check_system_services_updates_available( return cls(pipeline_response, deserialized, {}) return deserialized + check_system_services_updates_available.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/checkSystemServicesUpdatesAvailable'} # type: ignore + async def _update_system_services_initial( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.UpdateSystemServicesResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.UpdateSystemServicesResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._update_system_services_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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_update_system_services_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self._update_system_services_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 @@ -576,25 +523,29 @@ async def _update_system_services_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('UpdateSystemServicesResponse', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_system_services_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices'} # type: ignore + + @distributed_trace_async async def begin_update_system_services( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.UpdateSystemServicesResponse"]: """Updates system services in a cluster. @@ -604,15 +555,19 @@ async def begin_update_system_services( :type cluster_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a 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. - :return: An instance of AsyncLROPoller that returns either UpdateSystemServicesResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningcompute.models.UpdateSystemServicesResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 UpdateSystemServicesResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningcompute.models.UpdateSystemServicesResponse] + :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["_models.UpdateSystemServicesResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -626,24 +581,17 @@ async def begin_update_system_services( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('UpdateSystemServicesResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -655,13 +603,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_system_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, skiptoken: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PaginatedOperationalizationClustersList"]: """Gets the clusters in the specified resource group. @@ -670,8 +620,10 @@ def list_by_resource_group( :param skiptoken: Continuation token for pagination. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PaginatedOperationalizationClustersList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] + :return: An iterator like instance of either PaginatedOperationalizationClustersList or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedOperationalizationClustersList"] @@ -679,37 +631,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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 skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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, + skiptoken=skiptoken, + 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, + skiptoken=skiptoken, + 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('PaginatedOperationalizationClustersList', pipeline_response) + deserialized = self._deserialize("PaginatedOperationalizationClustersList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -727,23 +675,27 @@ 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.MachineLearningCompute/operationalizationClusters'} # type: ignore + @distributed_trace def list_by_subscription_id( self, skiptoken: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PaginatedOperationalizationClustersList"]: """Gets the operationalization clusters in the specified subscription. :param skiptoken: Continuation token for pagination. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PaginatedOperationalizationClustersList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] + :return: An iterator like instance of either PaginatedOperationalizationClustersList or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedOperationalizationClustersList"] @@ -751,36 +703,31 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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_id.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') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + skiptoken=skiptoken, + template_url=self.list_by_subscription_id.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_id_request( + subscription_id=self._config.subscription_id, + skiptoken=skiptoken, + 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('PaginatedOperationalizationClustersList', pipeline_response) + deserialized = self._deserialize("PaginatedOperationalizationClustersList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -798,6 +745,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/__init__.py index 73ceb102b5be..797a969316cd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/__init__.py @@ -6,64 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AcsClusterProperties - from ._models_py3 import AppInsightsCredentials - from ._models_py3 import AppInsightsProperties - from ._models_py3 import AutoScaleConfiguration - from ._models_py3 import AvailableOperations - from ._models_py3 import CheckSystemServicesUpdatesAvailableResponse - from ._models_py3 import ContainerRegistryCredentials - from ._models_py3 import ContainerRegistryProperties - from ._models_py3 import ContainerServiceCredentials - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseWrapper - from ._models_py3 import GlobalServiceConfiguration - from ._models_py3 import KubernetesClusterProperties - from ._models_py3 import OperationalizationCluster - from ._models_py3 import OperationalizationClusterCredentials - from ._models_py3 import OperationalizationClusterUpdateParameters - from ._models_py3 import PaginatedOperationalizationClustersList - from ._models_py3 import Resource - from ._models_py3 import ResourceOperation - from ._models_py3 import ResourceOperationDisplay - from ._models_py3 import ServiceAuthConfiguration - from ._models_py3 import ServicePrincipalProperties - from ._models_py3 import SslConfiguration - from ._models_py3 import StorageAccountCredentials - from ._models_py3 import StorageAccountProperties - from ._models_py3 import SystemService - from ._models_py3 import UpdateSystemServicesResponse -except (SyntaxError, ImportError): - from ._models import AcsClusterProperties # type: ignore - from ._models import AppInsightsCredentials # type: ignore - from ._models import AppInsightsProperties # type: ignore - from ._models import AutoScaleConfiguration # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import CheckSystemServicesUpdatesAvailableResponse # type: ignore - from ._models import ContainerRegistryCredentials # type: ignore - from ._models import ContainerRegistryProperties # type: ignore - from ._models import ContainerServiceCredentials # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseWrapper # type: ignore - from ._models import GlobalServiceConfiguration # type: ignore - from ._models import KubernetesClusterProperties # type: ignore - from ._models import OperationalizationCluster # type: ignore - from ._models import OperationalizationClusterCredentials # type: ignore - from ._models import OperationalizationClusterUpdateParameters # type: ignore - from ._models import PaginatedOperationalizationClustersList # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceOperation # type: ignore - from ._models import ResourceOperationDisplay # type: ignore - from ._models import ServiceAuthConfiguration # type: ignore - from ._models import ServicePrincipalProperties # type: ignore - from ._models import SslConfiguration # type: ignore - from ._models import StorageAccountCredentials # type: ignore - from ._models import StorageAccountProperties # type: ignore - from ._models import SystemService # type: ignore - from ._models import UpdateSystemServicesResponse # type: ignore +from ._models_py3 import AcsClusterProperties +from ._models_py3 import AppInsightsCredentials +from ._models_py3 import AppInsightsProperties +from ._models_py3 import AutoScaleConfiguration +from ._models_py3 import AvailableOperations +from ._models_py3 import CheckSystemServicesUpdatesAvailableResponse +from ._models_py3 import ContainerRegistryCredentials +from ._models_py3 import ContainerRegistryProperties +from ._models_py3 import ContainerServiceCredentials +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseWrapper +from ._models_py3 import GlobalServiceConfiguration +from ._models_py3 import KubernetesClusterProperties +from ._models_py3 import OperationalizationCluster +from ._models_py3 import OperationalizationClusterCredentials +from ._models_py3 import OperationalizationClusterUpdateParameters +from ._models_py3 import PaginatedOperationalizationClustersList +from ._models_py3 import Resource +from ._models_py3 import ResourceOperation +from ._models_py3 import ResourceOperationDisplay +from ._models_py3 import ServiceAuthConfiguration +from ._models_py3 import ServicePrincipalProperties +from ._models_py3 import SslConfiguration +from ._models_py3 import StorageAccountCredentials +from ._models_py3 import StorageAccountProperties +from ._models_py3 import SystemService +from ._models_py3 import UpdateSystemServicesResponse + from ._machine_learning_compute_management_client_enums import ( AgentVMSizeTypes, diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_machine_learning_compute_management_client_enums.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_machine_learning_compute_management_client_enums.py index f07194326483..6d9585a2bbff 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_machine_learning_compute_management_client_enums.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_machine_learning_compute_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 AgentVMSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AgentVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Azure VM size of the agent VM nodes. This cannot be changed once the cluster is created. This list is non exhaustive; refer to https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for the possible VM @@ -81,14 +66,14 @@ class AgentVMSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GS4 = "Standard_GS4" STANDARD_GS5 = "Standard_GS5" -class ClusterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The cluster type. """ ACS = "ACS" LOCAL = "Local" -class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. """ @@ -101,21 +86,21 @@ class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class OrchestratorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrchestratorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of orchestrator. It cannot be changed once the cluster is created. """ KUBERNETES = "Kubernetes" NONE = "None" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SSL status. Allowed values are Enabled and Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SystemServiceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SystemServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The system service type """ @@ -123,7 +108,7 @@ class SystemServiceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SCORING_FRONT_END = "ScoringFrontEnd" BATCH_FRONT_END = "BatchFrontEnd" -class UpdatesAvailable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdatesAvailable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Yes if updates are available for the system services, No if not. """ diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models.py deleted file mode 100644 index f6ed840f0cc4..000000000000 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models.py +++ /dev/null @@ -1,954 +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. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AcsClusterProperties(msrest.serialization.Model): - """Information about the container service backing the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar cluster_fqdn: The FQDN of the cluster. - :vartype cluster_fqdn: str - :param orchestrator_type: Required. Type of orchestrator. It cannot be changed once the cluster - is created. Possible values include: "Kubernetes", "None". - :type orchestrator_type: str or ~azure.mgmt.machinelearningcompute.models.OrchestratorType - :param orchestrator_properties: Orchestrator specific properties. - :type orchestrator_properties: - ~azure.mgmt.machinelearningcompute.models.KubernetesClusterProperties - :param system_services: The system services deployed to the cluster. - :type system_services: list[~azure.mgmt.machinelearningcompute.models.SystemService] - :param master_count: The number of master nodes in the container service. - :type master_count: int - :param agent_count: The number of agent nodes in the Container Service. This can be changed to - scale the cluster. - :type agent_count: int - :param agent_vm_size: The Azure VM size of the agent VM nodes. This cannot be changed once the - cluster is created. This list is non exhaustive; refer to - https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for the possible VM - sizes. Possible values include: "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3", - "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A9", - "Standard_A10", "Standard_A11", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", - "Standard_D11", "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", - "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D11_v2", - "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", "Standard_G1", "Standard_G2", - "Standard_G3", "Standard_G4", "Standard_G5", "Standard_DS1", "Standard_DS2", "Standard_DS3", - "Standard_DS4", "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", - "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". Default value: - "Standard_D3_v2". - :type agent_vm_size: str or ~azure.mgmt.machinelearningcompute.models.AgentVMSizeTypes - """ - - _validation = { - 'cluster_fqdn': {'readonly': True}, - 'orchestrator_type': {'required': True}, - 'master_count': {'maximum': 5, 'minimum': 1}, - 'agent_count': {'maximum': 100, 'minimum': 1}, - } - - _attribute_map = { - 'cluster_fqdn': {'key': 'clusterFqdn', 'type': 'str'}, - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_properties': {'key': 'orchestratorProperties', 'type': 'KubernetesClusterProperties'}, - 'system_services': {'key': 'systemServices', 'type': '[SystemService]'}, - 'master_count': {'key': 'masterCount', 'type': 'int'}, - 'agent_count': {'key': 'agentCount', 'type': 'int'}, - 'agent_vm_size': {'key': 'agentVmSize', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AcsClusterProperties, self).__init__(**kwargs) - self.cluster_fqdn = None - self.orchestrator_type = kwargs['orchestrator_type'] - self.orchestrator_properties = kwargs.get('orchestrator_properties', None) - self.system_services = kwargs.get('system_services', None) - self.master_count = kwargs.get('master_count', 1) - self.agent_count = kwargs.get('agent_count', 2) - self.agent_vm_size = kwargs.get('agent_vm_size', "Standard_D3_v2") - - -class AppInsightsCredentials(msrest.serialization.Model): - """AppInsights credentials. - - :param app_id: The AppInsights application ID. - :type app_id: str - :param instrumentation_key: The AppInsights instrumentation key. This is not returned in - response of GET/PUT on the resource. To see this please call listKeys API. - :type instrumentation_key: str - """ - - _attribute_map = { - 'app_id': {'key': 'appId', 'type': 'str'}, - 'instrumentation_key': {'key': 'instrumentationKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppInsightsCredentials, self).__init__(**kwargs) - self.app_id = kwargs.get('app_id', None) - self.instrumentation_key = kwargs.get('instrumentation_key', None) - - -class AppInsightsProperties(msrest.serialization.Model): - """Properties of App Insights. - - :param resource_id: ARM resource ID of the App Insights. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppInsightsProperties, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - - -class AutoScaleConfiguration(msrest.serialization.Model): - """AutoScale configuration properties. - - :param status: If auto-scale is enabled for all services. Each service can turn it off - individually. Possible values include: "Enabled", "Disabled". - :type status: str or ~azure.mgmt.machinelearningcompute.models.Status - :param min_replicas: The minimum number of replicas for each service. - :type min_replicas: int - :param max_replicas: The maximum number of replicas for each service. - :type max_replicas: int - :param target_utilization: The target utilization. - :type target_utilization: float - :param refresh_period_in_seconds: Refresh period in seconds. - :type refresh_period_in_seconds: int - """ - - _validation = { - 'min_replicas': {'minimum': 1}, - 'max_replicas': {'minimum': 1}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'min_replicas': {'key': 'minReplicas', 'type': 'int'}, - 'max_replicas': {'key': 'maxReplicas', 'type': 'int'}, - 'target_utilization': {'key': 'targetUtilization', 'type': 'float'}, - 'refresh_period_in_seconds': {'key': 'refreshPeriodInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoScaleConfiguration, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.min_replicas = kwargs.get('min_replicas', 1) - self.max_replicas = kwargs.get('max_replicas', 100) - self.target_utilization = kwargs.get('target_utilization', None) - self.refresh_period_in_seconds = kwargs.get('refresh_period_in_seconds', None) - - -class AvailableOperations(msrest.serialization.Model): - """Available operation list. - - :param value: An array of available operations. - :type value: list[~azure.mgmt.machinelearningcompute.models.ResourceOperation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceOperation]'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperations, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class CheckSystemServicesUpdatesAvailableResponse(msrest.serialization.Model): - """Information about updates available for system services in a cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar updates_available: Yes if updates are available for the system services, No if not. - Possible values include: "Yes", "No". - :vartype updates_available: str or ~azure.mgmt.machinelearningcompute.models.UpdatesAvailable - """ - - _validation = { - 'updates_available': {'readonly': True}, - } - - _attribute_map = { - 'updates_available': {'key': 'updatesAvailable', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckSystemServicesUpdatesAvailableResponse, self).__init__(**kwargs) - self.updates_available = None - - -class ContainerRegistryCredentials(msrest.serialization.Model): - """Information about the Azure Container Registry which contains the images deployed to the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar login_server: The ACR login server name. User name is the first part of the FQDN. - :vartype login_server: str - :ivar password: The ACR primary password. - :vartype password: str - :ivar password2: The ACR secondary password. - :vartype password2: str - :ivar username: The ACR login username. - :vartype username: str - """ - - _validation = { - 'login_server': {'readonly': True}, - 'password': {'readonly': True}, - 'password2': {'readonly': True}, - 'username': {'readonly': True}, - } - - _attribute_map = { - 'login_server': {'key': 'loginServer', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'password2': {'key': 'password2', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerRegistryCredentials, self).__init__(**kwargs) - self.login_server = None - self.password = None - self.password2 = None - self.username = None - - -class ContainerRegistryProperties(msrest.serialization.Model): - """Properties of Azure Container Registry. - - :param resource_id: ARM resource ID of the Azure Container Registry used to store Docker images - for web services in the cluster. If not provided one will be created. This cannot be changed - once the cluster is created. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerRegistryProperties, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - - -class ContainerServiceCredentials(msrest.serialization.Model): - """Information about the Azure Container Registry which contains the images deployed to the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar acs_kube_config: The ACS kube config file. - :vartype acs_kube_config: str - :ivar service_principal_configuration: Service principal configuration used by Kubernetes. - :vartype service_principal_configuration: - ~azure.mgmt.machinelearningcompute.models.ServicePrincipalProperties - :ivar image_pull_secret_name: The ACR image pull secret name which was created in Kubernetes. - :vartype image_pull_secret_name: str - """ - - _validation = { - 'acs_kube_config': {'readonly': True}, - 'service_principal_configuration': {'readonly': True}, - 'image_pull_secret_name': {'readonly': True}, - } - - _attribute_map = { - 'acs_kube_config': {'key': 'acsKubeConfig', 'type': 'str'}, - 'service_principal_configuration': {'key': 'servicePrincipalConfiguration', 'type': 'ServicePrincipalProperties'}, - 'image_pull_secret_name': {'key': 'imagePullSecretName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerServiceCredentials, self).__init__(**kwargs) - self.acs_kube_config = None - self.service_principal_configuration = None - self.image_pull_secret_name = None - - -class ErrorDetail(msrest.serialization.Model): - """Error detail information. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Error code. - :type code: str - :param message: Required. Error message. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response information. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Error code. - :type code: str - :param message: Required. Error message. - :type message: str - :param details: An array of error detail objects. - :type details: list[~azure.mgmt.machinelearningcompute.models.ErrorDetail] - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.details = kwargs.get('details', None) - - -class ErrorResponseWrapper(msrest.serialization.Model): - """Wrapper for error response to follow ARM guidelines. - - :param error: The error response. - :type error: ~azure.mgmt.machinelearningcompute.models.ErrorResponse - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseWrapper, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class GlobalServiceConfiguration(msrest.serialization.Model): - """Global configuration for services in the cluster. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, str] - :param etag: The configuration ETag for updates. - :type etag: str - :param ssl: The SSL configuration properties. - :type ssl: ~azure.mgmt.machinelearningcompute.models.SslConfiguration - :param service_auth: Optional global authorization keys for all user services deployed in - cluster. These are used if the service does not have auth keys. - :type service_auth: ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration - :param auto_scale: The auto-scale configuration. - :type auto_scale: ~azure.mgmt.machinelearningcompute.models.AutoScaleConfiguration - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'ssl': {'key': 'ssl', 'type': 'SslConfiguration'}, - 'service_auth': {'key': 'serviceAuth', 'type': 'ServiceAuthConfiguration'}, - 'auto_scale': {'key': 'autoScale', 'type': 'AutoScaleConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(GlobalServiceConfiguration, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.etag = kwargs.get('etag', None) - self.ssl = kwargs.get('ssl', None) - self.service_auth = kwargs.get('service_auth', None) - self.auto_scale = kwargs.get('auto_scale', None) - - -class KubernetesClusterProperties(msrest.serialization.Model): - """Kubernetes cluster specific properties. - - :param service_principal: The Azure Service Principal used by Kubernetes. - :type service_principal: ~azure.mgmt.machinelearningcompute.models.ServicePrincipalProperties - """ - - _attribute_map = { - 'service_principal': {'key': 'servicePrincipal', 'type': 'ServicePrincipalProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesClusterProperties, self).__init__(**kwargs) - self.service_principal = kwargs.get('service_principal', None) - - -class Resource(msrest.serialization.Model): - """Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :param location: Required. Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.location = kwargs['location'] - self.type = None - self.tags = kwargs.get('tags', None) - - -class OperationalizationCluster(Resource): - """Instance of an Azure ML Operationalization Cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :param location: Required. Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param description: The description of the cluster. - :type description: str - :ivar created_on: The date and time when the cluster was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The date and time when the cluster was last modified. - :vartype modified_on: ~datetime.datetime - :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, - Updating, Provisioning, Succeeded, and Failed. Possible values include: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.machinelearningcompute.models.OperationStatus - :ivar provisioning_errors: List of provisioning errors reported by the resource provider. - :vartype provisioning_errors: - list[~azure.mgmt.machinelearningcompute.models.ErrorResponseWrapper] - :param cluster_type: The cluster type. Possible values include: "ACS", "Local". - :type cluster_type: str or ~azure.mgmt.machinelearningcompute.models.ClusterType - :param storage_account: Storage Account properties. - :type storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountProperties - :param container_registry: Container Registry properties. - :type container_registry: ~azure.mgmt.machinelearningcompute.models.ContainerRegistryProperties - :param container_service: Parameters for the Azure Container Service cluster. - :type container_service: ~azure.mgmt.machinelearningcompute.models.AcsClusterProperties - :param app_insights: AppInsights configuration. - :type app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsProperties - :param global_service_configuration: Contains global configuration for the web services in the - cluster. - :type global_service_configuration: - ~azure.mgmt.machinelearningcompute.models.GlobalServiceConfiguration - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'location': {'required': True}, - 'type': {'readonly': True}, - 'created_on': {'readonly': True}, - 'modified_on': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, - 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'provisioning_errors': {'key': 'properties.provisioningErrors', 'type': '[ErrorResponseWrapper]'}, - 'cluster_type': {'key': 'properties.clusterType', 'type': 'str'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, - 'container_registry': {'key': 'properties.containerRegistry', 'type': 'ContainerRegistryProperties'}, - 'container_service': {'key': 'properties.containerService', 'type': 'AcsClusterProperties'}, - 'app_insights': {'key': 'properties.appInsights', 'type': 'AppInsightsProperties'}, - 'global_service_configuration': {'key': 'properties.globalServiceConfiguration', 'type': 'GlobalServiceConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationalizationCluster, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.created_on = None - self.modified_on = None - self.provisioning_state = None - self.provisioning_errors = None - self.cluster_type = kwargs.get('cluster_type', None) - self.storage_account = kwargs.get('storage_account', None) - self.container_registry = kwargs.get('container_registry', None) - self.container_service = kwargs.get('container_service', None) - self.app_insights = kwargs.get('app_insights', None) - self.global_service_configuration = kwargs.get('global_service_configuration', None) - - -class OperationalizationClusterCredentials(msrest.serialization.Model): - """Credentials to resources in the cluster. - - :param storage_account: Credentials for the Storage Account. - :type storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountCredentials - :param container_registry: Credentials for Azure Container Registry. - :type container_registry: - ~azure.mgmt.machinelearningcompute.models.ContainerRegistryCredentials - :param container_service: Credentials for Azure Container Service. - :type container_service: ~azure.mgmt.machinelearningcompute.models.ContainerServiceCredentials - :param app_insights: Credentials for Azure AppInsights. - :type app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsCredentials - :param service_auth_configuration: Global authorization keys for all user services deployed in - cluster. These are used if the service does not have auth keys. - :type service_auth_configuration: - ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration - :param ssl_configuration: The SSL configuration for the services. - :type ssl_configuration: ~azure.mgmt.machinelearningcompute.models.SslConfiguration - """ - - _attribute_map = { - 'storage_account': {'key': 'storageAccount', 'type': 'StorageAccountCredentials'}, - 'container_registry': {'key': 'containerRegistry', 'type': 'ContainerRegistryCredentials'}, - 'container_service': {'key': 'containerService', 'type': 'ContainerServiceCredentials'}, - 'app_insights': {'key': 'appInsights', 'type': 'AppInsightsCredentials'}, - 'service_auth_configuration': {'key': 'serviceAuthConfiguration', 'type': 'ServiceAuthConfiguration'}, - 'ssl_configuration': {'key': 'sslConfiguration', 'type': 'SslConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationalizationClusterCredentials, self).__init__(**kwargs) - self.storage_account = kwargs.get('storage_account', None) - self.container_registry = kwargs.get('container_registry', None) - self.container_service = kwargs.get('container_service', None) - self.app_insights = kwargs.get('app_insights', None) - self.service_auth_configuration = kwargs.get('service_auth_configuration', None) - self.ssl_configuration = kwargs.get('ssl_configuration', None) - - -class OperationalizationClusterUpdateParameters(msrest.serialization.Model): - """Parameters for PATCH operation on an operationalization cluster. - - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationalizationClusterUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class PaginatedOperationalizationClustersList(msrest.serialization.Model): - """Paginated list of operationalization clusters. - - :param value: An array of cluster objects. - :type value: list[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] - :param next_link: A continuation link (absolute URI) to the next page of results in the list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationalizationCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PaginatedOperationalizationClustersList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceOperation(msrest.serialization.Model): - """Resource operation. - - :param name: Name of this operation. - :type name: str - :param display: Display of the operation. - :type display: ~azure.mgmt.machinelearningcompute.models.ResourceOperationDisplay - :param origin: The operation origin. - :type origin: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceOperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - - -class ResourceOperationDisplay(msrest.serialization.Model): - """Display of the operation. - - :param provider: The resource provider name. - :type provider: str - :param resource: The resource name. - :type resource: str - :param operation: The operation. - :type operation: str - :param description: The description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ServiceAuthConfiguration(msrest.serialization.Model): - """Global service auth configuration properties. These are the data-plane authorization keys and are used if a service doesn't define it's own. - - All required parameters must be populated in order to send to Azure. - - :param primary_auth_key_hash: Required. The primary auth key hash. This is not returned in - response of GET/PUT on the resource.. To see this please call listKeys API. - :type primary_auth_key_hash: str - :param secondary_auth_key_hash: Required. The secondary auth key hash. This is not returned in - response of GET/PUT on the resource.. To see this please call listKeys API. - :type secondary_auth_key_hash: str - """ - - _validation = { - 'primary_auth_key_hash': {'required': True}, - 'secondary_auth_key_hash': {'required': True}, - } - - _attribute_map = { - 'primary_auth_key_hash': {'key': 'primaryAuthKeyHash', 'type': 'str'}, - 'secondary_auth_key_hash': {'key': 'secondaryAuthKeyHash', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceAuthConfiguration, self).__init__(**kwargs) - self.primary_auth_key_hash = kwargs['primary_auth_key_hash'] - self.secondary_auth_key_hash = kwargs['secondary_auth_key_hash'] - - -class ServicePrincipalProperties(msrest.serialization.Model): - """The Azure service principal used by Kubernetes for configuring load balancers. - - All required parameters must be populated in order to send to Azure. - - :param client_id: Required. The service principal client ID. - :type client_id: str - :param secret: Required. The service principal secret. This is not returned in response of - GET/PUT on the resource. To see this please call listKeys. - :type secret: str - """ - - _validation = { - 'client_id': {'required': True}, - 'secret': {'required': True}, - } - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicePrincipalProperties, self).__init__(**kwargs) - self.client_id = kwargs['client_id'] - self.secret = kwargs['secret'] - - -class SslConfiguration(msrest.serialization.Model): - """SSL configuration. If configured data-plane calls to user services will be exposed over SSL only. - - :param status: SSL status. Allowed values are Enabled and Disabled. Possible values include: - "Enabled", "Disabled". - :type status: str or ~azure.mgmt.machinelearningcompute.models.Status - :param cert: The SSL cert data in PEM format. - :type cert: str - :param key: The SSL key data in PEM format. This is not returned in response of GET/PUT on the - resource. To see this please call listKeys API. - :type key: str - :param cname: The CName of the certificate. - :type cname: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'cert': {'key': 'cert', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'cname': {'key': 'cname', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SslConfiguration, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.cert = kwargs.get('cert', None) - self.key = kwargs.get('key', None) - self.cname = kwargs.get('cname', None) - - -class StorageAccountCredentials(msrest.serialization.Model): - """Access information for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_id: The ARM resource ID of the storage account. - :vartype resource_id: str - :ivar primary_key: The primary key of the storage account. - :vartype primary_key: str - :ivar secondary_key: The secondary key of the storage account. - :vartype secondary_key: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentials, self).__init__(**kwargs) - self.resource_id = None - self.primary_key = None - self.secondary_key = None - - -class StorageAccountProperties(msrest.serialization.Model): - """Properties of Storage Account. - - :param resource_id: ARM resource ID of the Azure Storage Account to store CLI specific files. - If not provided one will be created. This cannot be changed once the cluster is created. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountProperties, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - - -class SystemService(msrest.serialization.Model): - """Information about a system service deployed in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param system_service_type: Required. The system service type. Possible values include: "None", - "ScoringFrontEnd", "BatchFrontEnd". - :type system_service_type: str or ~azure.mgmt.machinelearningcompute.models.SystemServiceType - :ivar public_ip_address: The public IP address of the system service. - :vartype public_ip_address: str - :ivar version: The state of the system service. - :vartype version: str - """ - - _validation = { - 'system_service_type': {'required': True}, - 'public_ip_address': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'system_service_type': {'key': 'systemServiceType', 'type': 'str'}, - 'public_ip_address': {'key': 'publicIpAddress', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemService, self).__init__(**kwargs) - self.system_service_type = kwargs['system_service_type'] - self.public_ip_address = None - self.version = None - - -class UpdateSystemServicesResponse(msrest.serialization.Model): - """Response of the update system services API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update_status: Update status. Possible values include: "Unknown", "Updating", "Creating", - "Deleting", "Succeeded", "Failed", "Canceled". - :vartype update_status: str or ~azure.mgmt.machinelearningcompute.models.OperationStatus - :ivar update_started_on: The date and time when the last system services update was started. - :vartype update_started_on: ~datetime.datetime - :ivar update_completed_on: The date and time when the last system services update completed. - :vartype update_completed_on: ~datetime.datetime - """ - - _validation = { - 'update_status': {'readonly': True}, - 'update_started_on': {'readonly': True}, - 'update_completed_on': {'readonly': True}, - } - - _attribute_map = { - 'update_status': {'key': 'updateStatus', 'type': 'str'}, - 'update_started_on': {'key': 'updateStartedOn', 'type': 'iso-8601'}, - 'update_completed_on': {'key': 'updateCompletedOn', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSystemServicesResponse, self).__init__(**kwargs) - self.update_status = None - self.update_started_on = None - self.update_completed_on = None diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models_py3.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models_py3.py index ce6fe4b0b556..6656a292bcaa 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models_py3.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models_py3.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -23,20 +23,20 @@ class AcsClusterProperties(msrest.serialization.Model): :ivar cluster_fqdn: The FQDN of the cluster. :vartype cluster_fqdn: str - :param orchestrator_type: Required. Type of orchestrator. It cannot be changed once the cluster + :ivar orchestrator_type: Required. Type of orchestrator. It cannot be changed once the cluster is created. Possible values include: "Kubernetes", "None". - :type orchestrator_type: str or ~azure.mgmt.machinelearningcompute.models.OrchestratorType - :param orchestrator_properties: Orchestrator specific properties. - :type orchestrator_properties: + :vartype orchestrator_type: str or ~azure.mgmt.machinelearningcompute.models.OrchestratorType + :ivar orchestrator_properties: Orchestrator specific properties. + :vartype orchestrator_properties: ~azure.mgmt.machinelearningcompute.models.KubernetesClusterProperties - :param system_services: The system services deployed to the cluster. - :type system_services: list[~azure.mgmt.machinelearningcompute.models.SystemService] - :param master_count: The number of master nodes in the container service. - :type master_count: int - :param agent_count: The number of agent nodes in the Container Service. This can be changed to + :ivar system_services: The system services deployed to the cluster. + :vartype system_services: list[~azure.mgmt.machinelearningcompute.models.SystemService] + :ivar master_count: The number of master nodes in the container service. + :vartype master_count: int + :ivar agent_count: The number of agent nodes in the Container Service. This can be changed to scale the cluster. - :type agent_count: int - :param agent_vm_size: The Azure VM size of the agent VM nodes. This cannot be changed once the + :vartype agent_count: int + :ivar agent_vm_size: The Azure VM size of the agent VM nodes. This cannot be changed once the cluster is created. This list is non exhaustive; refer to https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for the possible VM sizes. Possible values include: "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3", @@ -49,7 +49,7 @@ class AcsClusterProperties(msrest.serialization.Model): "Standard_DS4", "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". Default value: "Standard_D3_v2". - :type agent_vm_size: str or ~azure.mgmt.machinelearningcompute.models.AgentVMSizeTypes + :vartype agent_vm_size: str or ~azure.mgmt.machinelearningcompute.models.AgentVMSizeTypes """ _validation = { @@ -80,6 +80,35 @@ def __init__( agent_vm_size: Optional[Union[str, "AgentVMSizeTypes"]] = "Standard_D3_v2", **kwargs ): + """ + :keyword orchestrator_type: Required. Type of orchestrator. It cannot be changed once the + cluster is created. Possible values include: "Kubernetes", "None". + :paramtype orchestrator_type: str or ~azure.mgmt.machinelearningcompute.models.OrchestratorType + :keyword orchestrator_properties: Orchestrator specific properties. + :paramtype orchestrator_properties: + ~azure.mgmt.machinelearningcompute.models.KubernetesClusterProperties + :keyword system_services: The system services deployed to the cluster. + :paramtype system_services: list[~azure.mgmt.machinelearningcompute.models.SystemService] + :keyword master_count: The number of master nodes in the container service. + :paramtype master_count: int + :keyword agent_count: The number of agent nodes in the Container Service. This can be changed + to scale the cluster. + :paramtype agent_count: int + :keyword agent_vm_size: The Azure VM size of the agent VM nodes. This cannot be changed once + the cluster is created. This list is non exhaustive; refer to + https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for the possible VM + sizes. Possible values include: "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3", + "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A9", + "Standard_A10", "Standard_A11", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", + "Standard_D11", "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", + "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D11_v2", + "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", "Standard_G1", "Standard_G2", + "Standard_G3", "Standard_G4", "Standard_G5", "Standard_DS1", "Standard_DS2", "Standard_DS3", + "Standard_DS4", "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", + "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5". Default value: + "Standard_D3_v2". + :paramtype agent_vm_size: str or ~azure.mgmt.machinelearningcompute.models.AgentVMSizeTypes + """ super(AcsClusterProperties, self).__init__(**kwargs) self.cluster_fqdn = None self.orchestrator_type = orchestrator_type @@ -93,11 +122,11 @@ def __init__( class AppInsightsCredentials(msrest.serialization.Model): """AppInsights credentials. - :param app_id: The AppInsights application ID. - :type app_id: str - :param instrumentation_key: The AppInsights instrumentation key. This is not returned in + :ivar app_id: The AppInsights application ID. + :vartype app_id: str + :ivar instrumentation_key: The AppInsights instrumentation key. This is not returned in response of GET/PUT on the resource. To see this please call listKeys API. - :type instrumentation_key: str + :vartype instrumentation_key: str """ _attribute_map = { @@ -112,6 +141,13 @@ def __init__( instrumentation_key: Optional[str] = None, **kwargs ): + """ + :keyword app_id: The AppInsights application ID. + :paramtype app_id: str + :keyword instrumentation_key: The AppInsights instrumentation key. This is not returned in + response of GET/PUT on the resource. To see this please call listKeys API. + :paramtype instrumentation_key: str + """ super(AppInsightsCredentials, self).__init__(**kwargs) self.app_id = app_id self.instrumentation_key = instrumentation_key @@ -120,8 +156,8 @@ def __init__( class AppInsightsProperties(msrest.serialization.Model): """Properties of App Insights. - :param resource_id: ARM resource ID of the App Insights. - :type resource_id: str + :ivar resource_id: ARM resource ID of the App Insights. + :vartype resource_id: str """ _attribute_map = { @@ -134,6 +170,10 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: ARM resource ID of the App Insights. + :paramtype resource_id: str + """ super(AppInsightsProperties, self).__init__(**kwargs) self.resource_id = resource_id @@ -141,17 +181,17 @@ def __init__( class AutoScaleConfiguration(msrest.serialization.Model): """AutoScale configuration properties. - :param status: If auto-scale is enabled for all services. Each service can turn it off + :ivar status: If auto-scale is enabled for all services. Each service can turn it off individually. Possible values include: "Enabled", "Disabled". - :type status: str or ~azure.mgmt.machinelearningcompute.models.Status - :param min_replicas: The minimum number of replicas for each service. - :type min_replicas: int - :param max_replicas: The maximum number of replicas for each service. - :type max_replicas: int - :param target_utilization: The target utilization. - :type target_utilization: float - :param refresh_period_in_seconds: Refresh period in seconds. - :type refresh_period_in_seconds: int + :vartype status: str or ~azure.mgmt.machinelearningcompute.models.Status + :ivar min_replicas: The minimum number of replicas for each service. + :vartype min_replicas: int + :ivar max_replicas: The maximum number of replicas for each service. + :vartype max_replicas: int + :ivar target_utilization: The target utilization. + :vartype target_utilization: float + :ivar refresh_period_in_seconds: Refresh period in seconds. + :vartype refresh_period_in_seconds: int """ _validation = { @@ -177,6 +217,19 @@ def __init__( refresh_period_in_seconds: Optional[int] = None, **kwargs ): + """ + :keyword status: If auto-scale is enabled for all services. Each service can turn it off + individually. Possible values include: "Enabled", "Disabled". + :paramtype status: str or ~azure.mgmt.machinelearningcompute.models.Status + :keyword min_replicas: The minimum number of replicas for each service. + :paramtype min_replicas: int + :keyword max_replicas: The maximum number of replicas for each service. + :paramtype max_replicas: int + :keyword target_utilization: The target utilization. + :paramtype target_utilization: float + :keyword refresh_period_in_seconds: Refresh period in seconds. + :paramtype refresh_period_in_seconds: int + """ super(AutoScaleConfiguration, self).__init__(**kwargs) self.status = status self.min_replicas = min_replicas @@ -188,8 +241,8 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operation list. - :param value: An array of available operations. - :type value: list[~azure.mgmt.machinelearningcompute.models.ResourceOperation] + :ivar value: An array of available operations. + :vartype value: list[~azure.mgmt.machinelearningcompute.models.ResourceOperation] """ _attribute_map = { @@ -202,6 +255,10 @@ def __init__( value: Optional[List["ResourceOperation"]] = None, **kwargs ): + """ + :keyword value: An array of available operations. + :paramtype value: list[~azure.mgmt.machinelearningcompute.models.ResourceOperation] + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value @@ -228,6 +285,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckSystemServicesUpdatesAvailableResponse, self).__init__(**kwargs) self.updates_available = None @@ -265,6 +324,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerRegistryCredentials, self).__init__(**kwargs) self.login_server = None self.password = None @@ -275,10 +336,10 @@ def __init__( class ContainerRegistryProperties(msrest.serialization.Model): """Properties of Azure Container Registry. - :param resource_id: ARM resource ID of the Azure Container Registry used to store Docker images + :ivar resource_id: ARM resource ID of the Azure Container Registry used to store Docker images for web services in the cluster. If not provided one will be created. This cannot be changed once the cluster is created. - :type resource_id: str + :vartype resource_id: str """ _attribute_map = { @@ -291,6 +352,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: ARM resource ID of the Azure Container Registry used to store Docker + images for web services in the cluster. If not provided one will be created. This cannot be + changed once the cluster is created. + :paramtype resource_id: str + """ super(ContainerRegistryProperties, self).__init__(**kwargs) self.resource_id = resource_id @@ -325,6 +392,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerServiceCredentials, self).__init__(**kwargs) self.acs_kube_config = None self.service_principal_configuration = None @@ -336,10 +405,10 @@ class ErrorDetail(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Error code. - :type code: str - :param message: Required. Error message. - :type message: str + :ivar code: Required. Error code. + :vartype code: str + :ivar message: Required. Error message. + :vartype message: str """ _validation = { @@ -359,6 +428,12 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Error code. + :paramtype code: str + :keyword message: Required. Error message. + :paramtype message: str + """ super(ErrorDetail, self).__init__(**kwargs) self.code = code self.message = message @@ -369,12 +444,12 @@ class ErrorResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Error code. - :type code: str - :param message: Required. Error message. - :type message: str - :param details: An array of error detail objects. - :type details: list[~azure.mgmt.machinelearningcompute.models.ErrorDetail] + :ivar code: Required. Error code. + :vartype code: str + :ivar message: Required. Error message. + :vartype message: str + :ivar details: An array of error detail objects. + :vartype details: list[~azure.mgmt.machinelearningcompute.models.ErrorDetail] """ _validation = { @@ -396,6 +471,14 @@ def __init__( details: Optional[List["ErrorDetail"]] = None, **kwargs ): + """ + :keyword code: Required. Error code. + :paramtype code: str + :keyword message: Required. Error message. + :paramtype message: str + :keyword details: An array of error detail objects. + :paramtype details: list[~azure.mgmt.machinelearningcompute.models.ErrorDetail] + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -405,8 +488,8 @@ def __init__( class ErrorResponseWrapper(msrest.serialization.Model): """Wrapper for error response to follow ARM guidelines. - :param error: The error response. - :type error: ~azure.mgmt.machinelearningcompute.models.ErrorResponse + :ivar error: The error response. + :vartype error: ~azure.mgmt.machinelearningcompute.models.ErrorResponse """ _attribute_map = { @@ -419,6 +502,10 @@ def __init__( error: Optional["ErrorResponse"] = None, **kwargs ): + """ + :keyword error: The error response. + :paramtype error: ~azure.mgmt.machinelearningcompute.models.ErrorResponse + """ super(ErrorResponseWrapper, self).__init__(**kwargs) self.error = error @@ -426,22 +513,22 @@ def __init__( class GlobalServiceConfiguration(msrest.serialization.Model): """Global configuration for services in the cluster. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, str] - :param etag: The configuration ETag for updates. - :type etag: str - :param ssl: The SSL configuration properties. - :type ssl: ~azure.mgmt.machinelearningcompute.models.SslConfiguration - :param service_auth: Optional global authorization keys for all user services deployed in + :vartype additional_properties: dict[str, any] + :ivar etag: The configuration ETag for updates. + :vartype etag: str + :ivar ssl: The SSL configuration properties. + :vartype ssl: ~azure.mgmt.machinelearningcompute.models.SslConfiguration + :ivar service_auth: Optional global authorization keys for all user services deployed in cluster. These are used if the service does not have auth keys. - :type service_auth: ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration - :param auto_scale: The auto-scale configuration. - :type auto_scale: ~azure.mgmt.machinelearningcompute.models.AutoScaleConfiguration + :vartype service_auth: ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration + :ivar auto_scale: The auto-scale configuration. + :vartype auto_scale: ~azure.mgmt.machinelearningcompute.models.AutoScaleConfiguration """ _attribute_map = { - 'additional_properties': {'key': '', 'type': '{str}'}, + 'additional_properties': {'key': '', 'type': '{object}'}, 'etag': {'key': 'etag', 'type': 'str'}, 'ssl': {'key': 'ssl', 'type': 'SslConfiguration'}, 'service_auth': {'key': 'serviceAuth', 'type': 'ServiceAuthConfiguration'}, @@ -451,13 +538,27 @@ class GlobalServiceConfiguration(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, str]] = None, + additional_properties: Optional[Dict[str, Any]] = None, etag: Optional[str] = None, ssl: Optional["SslConfiguration"] = None, service_auth: Optional["ServiceAuthConfiguration"] = None, auto_scale: Optional["AutoScaleConfiguration"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword etag: The configuration ETag for updates. + :paramtype etag: str + :keyword ssl: The SSL configuration properties. + :paramtype ssl: ~azure.mgmt.machinelearningcompute.models.SslConfiguration + :keyword service_auth: Optional global authorization keys for all user services deployed in + cluster. These are used if the service does not have auth keys. + :paramtype service_auth: ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration + :keyword auto_scale: The auto-scale configuration. + :paramtype auto_scale: ~azure.mgmt.machinelearningcompute.models.AutoScaleConfiguration + """ super(GlobalServiceConfiguration, self).__init__(**kwargs) self.additional_properties = additional_properties self.etag = etag @@ -469,8 +570,9 @@ def __init__( class KubernetesClusterProperties(msrest.serialization.Model): """Kubernetes cluster specific properties. - :param service_principal: The Azure Service Principal used by Kubernetes. - :type service_principal: ~azure.mgmt.machinelearningcompute.models.ServicePrincipalProperties + :ivar service_principal: The Azure Service Principal used by Kubernetes. + :vartype service_principal: + ~azure.mgmt.machinelearningcompute.models.ServicePrincipalProperties """ _attribute_map = { @@ -483,6 +585,11 @@ def __init__( service_principal: Optional["ServicePrincipalProperties"] = None, **kwargs ): + """ + :keyword service_principal: The Azure Service Principal used by Kubernetes. + :paramtype service_principal: + ~azure.mgmt.machinelearningcompute.models.ServicePrincipalProperties + """ super(KubernetesClusterProperties, self).__init__(**kwargs) self.service_principal = service_principal @@ -498,12 +605,12 @@ class Resource(msrest.serialization.Model): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Required. Specifies the location of the resource. - :type location: str + :ivar location: Required. Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :vartype tags: dict[str, str] """ _validation = { @@ -528,6 +635,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -547,14 +660,14 @@ class OperationalizationCluster(Resource): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Required. Specifies the location of the resource. - :type location: str + :ivar location: Required. Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param description: The description of the cluster. - :type description: str + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :vartype tags: dict[str, str] + :ivar description: The description of the cluster. + :vartype description: str :ivar created_on: The date and time when the cluster was created. :vartype created_on: ~datetime.datetime :ivar modified_on: The date and time when the cluster was last modified. @@ -566,19 +679,20 @@ class OperationalizationCluster(Resource): :ivar provisioning_errors: List of provisioning errors reported by the resource provider. :vartype provisioning_errors: list[~azure.mgmt.machinelearningcompute.models.ErrorResponseWrapper] - :param cluster_type: The cluster type. Possible values include: "ACS", "Local". - :type cluster_type: str or ~azure.mgmt.machinelearningcompute.models.ClusterType - :param storage_account: Storage Account properties. - :type storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountProperties - :param container_registry: Container Registry properties. - :type container_registry: ~azure.mgmt.machinelearningcompute.models.ContainerRegistryProperties - :param container_service: Parameters for the Azure Container Service cluster. - :type container_service: ~azure.mgmt.machinelearningcompute.models.AcsClusterProperties - :param app_insights: AppInsights configuration. - :type app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsProperties - :param global_service_configuration: Contains global configuration for the web services in the + :ivar cluster_type: The cluster type. Possible values include: "ACS", "Local". + :vartype cluster_type: str or ~azure.mgmt.machinelearningcompute.models.ClusterType + :ivar storage_account: Storage Account properties. + :vartype storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountProperties + :ivar container_registry: Container Registry properties. + :vartype container_registry: + ~azure.mgmt.machinelearningcompute.models.ContainerRegistryProperties + :ivar container_service: Parameters for the Azure Container Service cluster. + :vartype container_service: ~azure.mgmt.machinelearningcompute.models.AcsClusterProperties + :ivar app_insights: AppInsights configuration. + :vartype app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsProperties + :ivar global_service_configuration: Contains global configuration for the web services in the cluster. - :type global_service_configuration: + :vartype global_service_configuration: ~azure.mgmt.machinelearningcompute.models.GlobalServiceConfiguration """ @@ -626,6 +740,29 @@ def __init__( global_service_configuration: Optional["GlobalServiceConfiguration"] = None, **kwargs ): + """ + :keyword location: Required. Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :paramtype tags: dict[str, str] + :keyword description: The description of the cluster. + :paramtype description: str + :keyword cluster_type: The cluster type. Possible values include: "ACS", "Local". + :paramtype cluster_type: str or ~azure.mgmt.machinelearningcompute.models.ClusterType + :keyword storage_account: Storage Account properties. + :paramtype storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountProperties + :keyword container_registry: Container Registry properties. + :paramtype container_registry: + ~azure.mgmt.machinelearningcompute.models.ContainerRegistryProperties + :keyword container_service: Parameters for the Azure Container Service cluster. + :paramtype container_service: ~azure.mgmt.machinelearningcompute.models.AcsClusterProperties + :keyword app_insights: AppInsights configuration. + :paramtype app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsProperties + :keyword global_service_configuration: Contains global configuration for the web services in + the cluster. + :paramtype global_service_configuration: + ~azure.mgmt.machinelearningcompute.models.GlobalServiceConfiguration + """ super(OperationalizationCluster, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.created_on = None @@ -643,21 +780,22 @@ def __init__( class OperationalizationClusterCredentials(msrest.serialization.Model): """Credentials to resources in the cluster. - :param storage_account: Credentials for the Storage Account. - :type storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountCredentials - :param container_registry: Credentials for Azure Container Registry. - :type container_registry: + :ivar storage_account: Credentials for the Storage Account. + :vartype storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountCredentials + :ivar container_registry: Credentials for Azure Container Registry. + :vartype container_registry: ~azure.mgmt.machinelearningcompute.models.ContainerRegistryCredentials - :param container_service: Credentials for Azure Container Service. - :type container_service: ~azure.mgmt.machinelearningcompute.models.ContainerServiceCredentials - :param app_insights: Credentials for Azure AppInsights. - :type app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsCredentials - :param service_auth_configuration: Global authorization keys for all user services deployed in + :ivar container_service: Credentials for Azure Container Service. + :vartype container_service: + ~azure.mgmt.machinelearningcompute.models.ContainerServiceCredentials + :ivar app_insights: Credentials for Azure AppInsights. + :vartype app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsCredentials + :ivar service_auth_configuration: Global authorization keys for all user services deployed in cluster. These are used if the service does not have auth keys. - :type service_auth_configuration: + :vartype service_auth_configuration: ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration - :param ssl_configuration: The SSL configuration for the services. - :type ssl_configuration: ~azure.mgmt.machinelearningcompute.models.SslConfiguration + :ivar ssl_configuration: The SSL configuration for the services. + :vartype ssl_configuration: ~azure.mgmt.machinelearningcompute.models.SslConfiguration """ _attribute_map = { @@ -680,6 +818,24 @@ def __init__( ssl_configuration: Optional["SslConfiguration"] = None, **kwargs ): + """ + :keyword storage_account: Credentials for the Storage Account. + :paramtype storage_account: ~azure.mgmt.machinelearningcompute.models.StorageAccountCredentials + :keyword container_registry: Credentials for Azure Container Registry. + :paramtype container_registry: + ~azure.mgmt.machinelearningcompute.models.ContainerRegistryCredentials + :keyword container_service: Credentials for Azure Container Service. + :paramtype container_service: + ~azure.mgmt.machinelearningcompute.models.ContainerServiceCredentials + :keyword app_insights: Credentials for Azure AppInsights. + :paramtype app_insights: ~azure.mgmt.machinelearningcompute.models.AppInsightsCredentials + :keyword service_auth_configuration: Global authorization keys for all user services deployed + in cluster. These are used if the service does not have auth keys. + :paramtype service_auth_configuration: + ~azure.mgmt.machinelearningcompute.models.ServiceAuthConfiguration + :keyword ssl_configuration: The SSL configuration for the services. + :paramtype ssl_configuration: ~azure.mgmt.machinelearningcompute.models.SslConfiguration + """ super(OperationalizationClusterCredentials, self).__init__(**kwargs) self.storage_account = storage_account self.container_registry = container_registry @@ -692,11 +848,11 @@ def __init__( class OperationalizationClusterUpdateParameters(msrest.serialization.Model): """Parameters for PATCH operation on an operationalization cluster. - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] + :vartype tags: dict[str, str] """ _attribute_map = { @@ -709,6 +865,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + """ super(OperationalizationClusterUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -716,10 +879,10 @@ def __init__( class PaginatedOperationalizationClustersList(msrest.serialization.Model): """Paginated list of operationalization clusters. - :param value: An array of cluster objects. - :type value: list[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] - :param next_link: A continuation link (absolute URI) to the next page of results in the list. - :type next_link: str + :ivar value: An array of cluster objects. + :vartype value: list[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] + :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. + :vartype next_link: str """ _attribute_map = { @@ -734,6 +897,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: An array of cluster objects. + :paramtype value: list[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] + :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. + :paramtype next_link: str + """ super(PaginatedOperationalizationClustersList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -742,12 +911,12 @@ def __init__( class ResourceOperation(msrest.serialization.Model): """Resource operation. - :param name: Name of this operation. - :type name: str - :param display: Display of the operation. - :type display: ~azure.mgmt.machinelearningcompute.models.ResourceOperationDisplay - :param origin: The operation origin. - :type origin: str + :ivar name: Name of this operation. + :vartype name: str + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.machinelearningcompute.models.ResourceOperationDisplay + :ivar origin: The operation origin. + :vartype origin: str """ _attribute_map = { @@ -764,6 +933,14 @@ def __init__( origin: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of this operation. + :paramtype name: str + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.machinelearningcompute.models.ResourceOperationDisplay + :keyword origin: The operation origin. + :paramtype origin: str + """ super(ResourceOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -773,14 +950,14 @@ def __init__( class ResourceOperationDisplay(msrest.serialization.Model): """Display of the operation. - :param provider: The resource provider name. - :type provider: str - :param resource: The resource name. - :type resource: str - :param operation: The operation. - :type operation: str - :param description: The description of the operation. - :type description: str + :ivar provider: The resource provider name. + :vartype provider: str + :ivar resource: The resource name. + :vartype resource: str + :ivar operation: The operation. + :vartype operation: str + :ivar description: The description of the operation. + :vartype description: str """ _attribute_map = { @@ -799,6 +976,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name. + :paramtype provider: str + :keyword resource: The resource name. + :paramtype resource: str + :keyword operation: The operation. + :paramtype operation: str + :keyword description: The description of the operation. + :paramtype description: str + """ super(ResourceOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -811,12 +998,12 @@ class ServiceAuthConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param primary_auth_key_hash: Required. The primary auth key hash. This is not returned in + :ivar primary_auth_key_hash: Required. The primary auth key hash. This is not returned in response of GET/PUT on the resource.. To see this please call listKeys API. - :type primary_auth_key_hash: str - :param secondary_auth_key_hash: Required. The secondary auth key hash. This is not returned in + :vartype primary_auth_key_hash: str + :ivar secondary_auth_key_hash: Required. The secondary auth key hash. This is not returned in response of GET/PUT on the resource.. To see this please call listKeys API. - :type secondary_auth_key_hash: str + :vartype secondary_auth_key_hash: str """ _validation = { @@ -836,6 +1023,14 @@ def __init__( secondary_auth_key_hash: str, **kwargs ): + """ + :keyword primary_auth_key_hash: Required. The primary auth key hash. This is not returned in + response of GET/PUT on the resource.. To see this please call listKeys API. + :paramtype primary_auth_key_hash: str + :keyword secondary_auth_key_hash: Required. The secondary auth key hash. This is not returned + in response of GET/PUT on the resource.. To see this please call listKeys API. + :paramtype secondary_auth_key_hash: str + """ super(ServiceAuthConfiguration, self).__init__(**kwargs) self.primary_auth_key_hash = primary_auth_key_hash self.secondary_auth_key_hash = secondary_auth_key_hash @@ -846,11 +1041,11 @@ class ServicePrincipalProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client_id: Required. The service principal client ID. - :type client_id: str - :param secret: Required. The service principal secret. This is not returned in response of + :ivar client_id: Required. The service principal client ID. + :vartype client_id: str + :ivar secret: Required. The service principal secret. This is not returned in response of GET/PUT on the resource. To see this please call listKeys. - :type secret: str + :vartype secret: str """ _validation = { @@ -870,6 +1065,13 @@ def __init__( secret: str, **kwargs ): + """ + :keyword client_id: Required. The service principal client ID. + :paramtype client_id: str + :keyword secret: Required. The service principal secret. This is not returned in response of + GET/PUT on the resource. To see this please call listKeys. + :paramtype secret: str + """ super(ServicePrincipalProperties, self).__init__(**kwargs) self.client_id = client_id self.secret = secret @@ -878,16 +1080,16 @@ def __init__( class SslConfiguration(msrest.serialization.Model): """SSL configuration. If configured data-plane calls to user services will be exposed over SSL only. - :param status: SSL status. Allowed values are Enabled and Disabled. Possible values include: + :ivar status: SSL status. Allowed values are Enabled and Disabled. Possible values include: "Enabled", "Disabled". - :type status: str or ~azure.mgmt.machinelearningcompute.models.Status - :param cert: The SSL cert data in PEM format. - :type cert: str - :param key: The SSL key data in PEM format. This is not returned in response of GET/PUT on the + :vartype status: str or ~azure.mgmt.machinelearningcompute.models.Status + :ivar cert: The SSL cert data in PEM format. + :vartype cert: str + :ivar key: The SSL key data in PEM format. This is not returned in response of GET/PUT on the resource. To see this please call listKeys API. - :type key: str - :param cname: The CName of the certificate. - :type cname: str + :vartype key: str + :ivar cname: The CName of the certificate. + :vartype cname: str """ _attribute_map = { @@ -906,6 +1108,18 @@ def __init__( cname: Optional[str] = None, **kwargs ): + """ + :keyword status: SSL status. Allowed values are Enabled and Disabled. Possible values include: + "Enabled", "Disabled". + :paramtype status: str or ~azure.mgmt.machinelearningcompute.models.Status + :keyword cert: The SSL cert data in PEM format. + :paramtype cert: str + :keyword key: The SSL key data in PEM format. This is not returned in response of GET/PUT on + the resource. To see this please call listKeys API. + :paramtype key: str + :keyword cname: The CName of the certificate. + :paramtype cname: str + """ super(SslConfiguration, self).__init__(**kwargs) self.status = status self.cert = cert @@ -942,6 +1156,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentials, self).__init__(**kwargs) self.resource_id = None self.primary_key = None @@ -951,9 +1167,9 @@ def __init__( class StorageAccountProperties(msrest.serialization.Model): """Properties of Storage Account. - :param resource_id: ARM resource ID of the Azure Storage Account to store CLI specific files. - If not provided one will be created. This cannot be changed once the cluster is created. - :type resource_id: str + :ivar resource_id: ARM resource ID of the Azure Storage Account to store CLI specific files. If + not provided one will be created. This cannot be changed once the cluster is created. + :vartype resource_id: str """ _attribute_map = { @@ -966,6 +1182,11 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: ARM resource ID of the Azure Storage Account to store CLI specific files. + If not provided one will be created. This cannot be changed once the cluster is created. + :paramtype resource_id: str + """ super(StorageAccountProperties, self).__init__(**kwargs) self.resource_id = resource_id @@ -977,9 +1198,10 @@ class SystemService(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param system_service_type: Required. The system service type. Possible values include: "None", + :ivar system_service_type: Required. The system service type. Possible values include: "None", "ScoringFrontEnd", "BatchFrontEnd". - :type system_service_type: str or ~azure.mgmt.machinelearningcompute.models.SystemServiceType + :vartype system_service_type: str or + ~azure.mgmt.machinelearningcompute.models.SystemServiceType :ivar public_ip_address: The public IP address of the system service. :vartype public_ip_address: str :ivar version: The state of the system service. @@ -1004,6 +1226,12 @@ def __init__( system_service_type: Union[str, "SystemServiceType"], **kwargs ): + """ + :keyword system_service_type: Required. The system service type. Possible values include: + "None", "ScoringFrontEnd", "BatchFrontEnd". + :paramtype system_service_type: str or + ~azure.mgmt.machinelearningcompute.models.SystemServiceType + """ super(SystemService, self).__init__(**kwargs) self.system_service_type = system_service_type self.public_ip_address = None @@ -1040,6 +1268,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateSystemServicesResponse, self).__init__(**kwargs) self.update_status = None self.update_started_on = None diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_machine_learning_compute_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_machine_learning_compute_operations.py index b6bbe129c8ce..06dbe6f36861 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_machine_learning_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_machine_learning_compute_operations.py @@ -5,22 +5,49 @@ # 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, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_available_operations_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.MachineLearningCompute/operations') + + # 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 + ) class MachineLearningComputeOperations(object): """MachineLearningComputeOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_available_operations( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableOperations" + **kwargs: Any + ) -> "_models.AvailableOperations": """Gets all available operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,21 +88,14 @@ def list_available_operations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_available_operations.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_available_operations_request( + template_url=self.list_available_operations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,6 @@ def list_available_operations( return cls(pipeline_response, deserialized, {}) return deserialized + list_available_operations.metadata = {'url': '/providers/Microsoft.MachineLearningCompute/operations'} # type: ignore + diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_operationalization_clusters_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_operationalization_clusters_operations.py index 8851e706db7a..75d85fa2737e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_operationalization_clusters_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/operations/_operationalization_clusters_operations.py @@ -5,25 +5,367 @@ # 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 msrest import Serializer from .. import models as _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 .._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_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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, + cluster_name: str, + *, + delete_all: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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 delete_all is not None: + query_parameters['deleteAll'] = _SERIALIZER.query("delete_all", delete_all, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_keys_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/listKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_system_services_updates_available_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/checkSystemServicesUpdatesAvailable') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_system_services_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + 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 skiptoken is not None: + query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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_subscription_id_request( + subscription_id: str, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters') + 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') + if skiptoken is not None: + query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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 OperationalizationClustersOperations(object): """OperationalizationClustersOperations operations. @@ -49,50 +391,38 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.OperationalizationCluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationalizationCluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.OperationalizationCluster", + **kwargs: Any + ) -> "_models.OperationalizationCluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationalizationCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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(parameters, 'OperationalizationCluster') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(parameters, 'OperationalizationCluster') - 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -104,16 +434,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.OperationalizationCluster" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationalizationCluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.OperationalizationCluster", + **kwargs: Any + ) -> LROPoller["_models.OperationalizationCluster"]: """Create or update an operationalization cluster. :param resource_group_name: Name of the resource group in which the cluster is located. @@ -124,15 +456,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.machinelearningcompute.models.OperationalizationCluster :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a 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. - :return: An instance of LROPoller that returns either OperationalizationCluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] - :raises ~azure.core.exceptions.HttpResponseError: + :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 OperationalizationCluster or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningcompute.models.OperationalizationCluster] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationalizationCluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,27 +481,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationalizationCluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -176,15 +507,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationalizationCluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.OperationalizationCluster": """Gets the operationalization cluster resource view. Note that the credentials are not returned by this call. Call ListKeys to get them. @@ -202,33 +534,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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, + cluster_name=cluster_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -237,16 +559,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.OperationalizationClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationalizationCluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.OperationalizationClusterUpdateParameters", + **kwargs: Any + ) -> "_models.OperationalizationCluster": """The PATCH operation can be used to update only the tags for a cluster. Use PUT operation to update other properties. @@ -255,7 +579,8 @@ def update( :param cluster_name: The name of the cluster. :type cluster_name: str :param parameters: The parameters supplied to patch the cluster. - :type parameters: ~azure.mgmt.machinelearningcompute.models.OperationalizationClusterUpdateParameters + :type parameters: + ~azure.mgmt.machinelearningcompute.models.OperationalizationClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationalizationCluster, or the result of cls(response) :rtype: ~azure.mgmt.machinelearningcompute.models.OperationalizationCluster @@ -266,38 +591,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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(parameters, 'OperationalizationClusterUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.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(parameters, 'OperationalizationClusterUpdateParameters') - 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationalizationCluster', pipeline_response) @@ -306,69 +621,60 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - delete_all=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + delete_all: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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 delete_all is not None: - query_parameters['deleteAll'] = self._serialize.query("delete_all", delete_all, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + delete_all=delete_all, + 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 if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWrapper, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - delete_all=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + delete_all: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified cluster. :param resource_group_name: Name of the resource group in which the cluster is located. @@ -379,15 +685,17 @@ def begin_delete( :type delete_all: bool :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a 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', @@ -402,21 +710,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, {}) - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -428,15 +729,16 @@ 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.MachineLearningCompute/operationalizationClusters/{clusterName}'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationalizationClusterCredentials" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.OperationalizationClusterCredentials": """Gets the credentials for the specified cluster such as Storage, ACR and ACS credentials. This is a long running operation because it fetches keys from dependencies. @@ -454,27 +756,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_keys.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 @@ -488,15 +780,17 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/listKeys'} # type: ignore + + @distributed_trace def check_system_services_updates_available( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckSystemServicesUpdatesAvailableResponse" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.CheckSystemServicesUpdatesAvailableResponse": """Checks if updates are available for system services in the cluster. :param resource_group_name: Name of the resource group in which the cluster is located. @@ -513,27 +807,17 @@ def check_system_services_updates_available( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.check_system_services_updates_available.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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_check_system_services_updates_available_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.check_system_services_updates_available.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 @@ -547,41 +831,32 @@ def check_system_services_updates_available( return cls(pipeline_response, deserialized, {}) return deserialized + check_system_services_updates_available.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/checkSystemServicesUpdatesAvailable'} # type: ignore + def _update_system_services_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.UpdateSystemServicesResponse"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Optional["_models.UpdateSystemServicesResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.UpdateSystemServicesResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._update_system_services_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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - 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_update_system_services_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self._update_system_services_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 @@ -589,27 +864,30 @@ def _update_system_services_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('UpdateSystemServicesResponse', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_system_services_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices'} # type: ignore + + @distributed_trace def begin_update_system_services( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.UpdateSystemServicesResponse"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller["_models.UpdateSystemServicesResponse"]: """Updates system services in a cluster. :param resource_group_name: Name of the resource group in which the cluster is located. @@ -618,15 +896,19 @@ def begin_update_system_services( :type cluster_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a 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. - :return: An instance of LROPoller that returns either UpdateSystemServicesResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningcompute.models.UpdateSystemServicesResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 UpdateSystemServicesResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningcompute.models.UpdateSystemServicesResponse] + :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["_models.UpdateSystemServicesResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,24 +922,17 @@ def begin_update_system_services( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('UpdateSystemServicesResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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: @@ -669,15 +944,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_system_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - skiptoken=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PaginatedOperationalizationClustersList"] + resource_group_name: str, + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.PaginatedOperationalizationClustersList"]: """Gets the clusters in the specified resource group. :param resource_group_name: Name of the resource group in which the cluster is located. @@ -685,8 +961,10 @@ def list_by_resource_group( :param skiptoken: Continuation token for pagination. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PaginatedOperationalizationClustersList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] + :return: An iterator like instance of either PaginatedOperationalizationClustersList or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedOperationalizationClustersList"] @@ -694,37 +972,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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 skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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, + skiptoken=skiptoken, + 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, + skiptoken=skiptoken, + 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('PaginatedOperationalizationClustersList', pipeline_response) + deserialized = self._deserialize("PaginatedOperationalizationClustersList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -742,24 +1016,27 @@ 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.MachineLearningCompute/operationalizationClusters'} # type: ignore + @distributed_trace def list_by_subscription_id( self, - skiptoken=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PaginatedOperationalizationClustersList"] + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.PaginatedOperationalizationClustersList"]: """Gets the operationalization clusters in the specified subscription. :param skiptoken: Continuation token for pagination. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PaginatedOperationalizationClustersList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] + :return: An iterator like instance of either PaginatedOperationalizationClustersList or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningcompute.models.PaginatedOperationalizationClustersList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedOperationalizationClustersList"] @@ -767,36 +1044,31 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-08-01-preview" - accept = "application/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_id.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') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + skiptoken=skiptoken, + template_url=self.list_by_subscription_id.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_id_request( + subscription_id=self._config.subscription_id, + skiptoken=skiptoken, + 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('PaginatedOperationalizationClustersList', pipeline_response) + deserialized = self._deserialize("PaginatedOperationalizationClustersList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -814,6 +1086,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data )