diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json b/sdk/machinelearning/azure-mgmt-guestconfig/_meta.json index acfcecc0577c..8499969527b8 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.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "33b8d6f7bf2eb081fe134333b0fc445777e488d6", + "commit": "b72597d9112b6f2e41d9ff70dea876631ac9f70d", "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-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.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..ea55238d816d 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_configuration.py @@ -6,22 +6,20 @@ # 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 -class GuestConfigurationClientConfiguration(Configuration): +class GuestConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for GuestConfigurationClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class GuestConfigurationClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2022-01-25". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ 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) + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + 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 - self.api_version = "2020-06-25" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-guestconfig/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,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..ae0cba18ffde 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,110 @@ # 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, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -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 azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -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 +from ._configuration import GuestConfigurationClientConfiguration +from .operations import GuestConfigurationAssignmentReportsOperations, GuestConfigurationAssignmentReportsVMSSOperations, GuestConfigurationAssignmentsOperations, GuestConfigurationAssignmentsVMSSOperations, GuestConfigurationHCRPAssignmentReportsOperations, GuestConfigurationHCRPAssignmentsOperations, Operations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class GuestConfigurationClient(object): +class GuestConfigurationClient: # pylint: disable=too-many-instance-attributes """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 guest_configuration_assignments_vmss: GuestConfigurationAssignmentsVMSSOperations + operations + :vartype guest_configuration_assignments_vmss: + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsVMSSOperations + :ivar guest_configuration_assignment_reports_vmss: + GuestConfigurationAssignmentReportsVMSSOperations operations + :vartype guest_configuration_assignment_reports_vmss: + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsVMSSOperations :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 + :keyword api_version: Api Version. Default value is "2022-01-25". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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.guest_configuration_assignments_vmss = GuestConfigurationAssignmentsVMSSOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_assignment_reports_vmss = GuestConfigurationAssignmentReportsVMSSOperations(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: 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..1a12171edaa6 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2020-06-25", - "total_api_version_list": ["2020-06-25"], + "chosen_version": "2022-01-25", + "total_api_version_list": ["2022-01-25"], "client": { "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\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"GuestConfigurationClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"GuestConfigurationClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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,17 +91,18 @@ "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", "guest_configuration_assignment_reports": "GuestConfigurationAssignmentReportsOperations", "guest_configuration_hcrp_assignments": "GuestConfigurationHCRPAssignmentsOperations", "guest_configuration_hcrp_assignment_reports": "GuestConfigurationHCRPAssignmentReportsOperations", + "guest_configuration_assignments_vmss": "GuestConfigurationAssignmentsVMSSOperations", + "guest_configuration_assignment_reports_vmss": "GuestConfigurationAssignmentReportsVMSSOperations", "operations": "Operations" } } \ No newline at end of file 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..485fc00302d8 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class GuestConfigurationClientConfiguration(Configuration): +class GuestConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for GuestConfigurationClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class GuestConfigurationClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2022-01-25". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(GuestConfigurationClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + 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 - self.api_version = "2020-06-25" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-guestconfig/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,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..595ca26d2afc 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,110 @@ # 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, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -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 +from ._configuration import GuestConfigurationClientConfiguration +from .operations import GuestConfigurationAssignmentReportsOperations, GuestConfigurationAssignmentReportsVMSSOperations, GuestConfigurationAssignmentsOperations, GuestConfigurationAssignmentsVMSSOperations, GuestConfigurationHCRPAssignmentReportsOperations, GuestConfigurationHCRPAssignmentsOperations, Operations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class GuestConfigurationClient(object): +class GuestConfigurationClient: # pylint: disable=too-many-instance-attributes """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 guest_configuration_assignments_vmss: GuestConfigurationAssignmentsVMSSOperations + operations + :vartype guest_configuration_assignments_vmss: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentsVMSSOperations + :ivar guest_configuration_assignment_reports_vmss: + GuestConfigurationAssignmentReportsVMSSOperations operations + :vartype guest_configuration_assignment_reports_vmss: + azure.mgmt.guestconfig.aio.operations.GuestConfigurationAssignmentReportsVMSSOperations :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 + :keyword api_version: Api Version. Default value is "2022-01-25". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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.guest_configuration_assignments_vmss = GuestConfigurationAssignmentsVMSSOperations(self._client, self._config, self._serialize, self._deserialize) + self.guest_configuration_assignment_reports_vmss = GuestConfigurationAssignmentReportsVMSSOperations(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/__init__.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/__init__.py index 9ec9e96e98e5..63baf4a4a875 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/__init__.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/__init__.py @@ -10,6 +10,8 @@ from ._guest_configuration_assignment_reports_operations import GuestConfigurationAssignmentReportsOperations from ._guest_configuration_hcrp_assignments_operations import GuestConfigurationHCRPAssignmentsOperations from ._guest_configuration_hcrp_assignment_reports_operations import GuestConfigurationHCRPAssignmentReportsOperations +from ._guest_configuration_assignments_vmss_operations import GuestConfigurationAssignmentsVMSSOperations +from ._guest_configuration_assignment_reports_vmss_operations import GuestConfigurationAssignmentReportsVMSSOperations from ._operations import Operations __all__ = [ @@ -17,5 +19,7 @@ 'GuestConfigurationAssignmentReportsOperations', 'GuestConfigurationHCRPAssignmentsOperations', 'GuestConfigurationHCRPAssignmentReportsOperations', + 'GuestConfigurationAssignmentsVMSSOperations', + 'GuestConfigurationAssignmentReportsVMSSOperations', 'Operations', ] 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..f590eaad6356 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, 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 +43,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 +69,31 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +102,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 + 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 +135,32 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +169,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 + + 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_assignment_reports_vmss_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_vmss_operations.py new file mode 100644 index 000000000000..219f3c339565 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignment_reports_vmss_operations.py @@ -0,0 +1,202 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +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 +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_assignment_reports_vmss_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GuestConfigurationAssignmentReportsVMSSOperations: + """GuestConfigurationAssignmentReportsVMSSOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.guestconfig.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GuestConfigurationAssignmentReportList"]: + """List all reports for the VMSS guest configuration assignment, latest report first. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestConfigurationAssignmentReportList or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentReportList"] + 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_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + 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("GuestConfigurationAssignmentReportList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vmss_name: str, + name: str, + id: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReport": + """Get a report for the VMSS guest configuration assignment, by reportId. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :param id: The GUID for the guest configuration assignment report. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignmentReport, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentReport"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + id=id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{id}"} # 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..42cdcf2958e6 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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 +74,35 @@ 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 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 +115,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 + 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 +145,31 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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,9 +178,12 @@ 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 - async def delete( + 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( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, guest_configuration_assignment_name: str, @@ -204,41 +208,193 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + 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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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, + api_version=api_version, + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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, + api_version=api_version, + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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,45 +408,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -299,17 +458,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_vmss_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_vmss_operations.py new file mode 100644 index 000000000000..0906530889d7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/operations/_guest_configuration_assignments_vmss_operations.py @@ -0,0 +1,258 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +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 +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_vmss_operations import build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GuestConfigurationAssignmentsVMSSOperations: + """GuestConfigurationAssignmentsVMSSOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.guestconfig.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": + """Get information about a guest configuration assignment for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}"} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.GuestConfigurationAssignment"]: + """Delete a guest configuration assignment for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GuestConfigurationAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vmss_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vmss_name=vmss_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vmss_name=vmss_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore 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..8606d2b3b230 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, 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 +43,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 +69,31 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +102,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 + 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 +135,32 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +169,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 + + 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..eea729804905 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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 +74,35 @@ 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 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 +115,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 + 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 +145,31 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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,9 +178,12 @@ 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 - async def delete( + 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( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, guest_configuration_assignment_name: str, @@ -204,41 +208,40 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + 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,45 +255,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -299,17 +305,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore 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..ae9dea43325e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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.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 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -52,35 +56,36 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.guestconfig.models.OperationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] error_map = { 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( + api_version=api_version, + 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( + api_version=api_version, + 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) @@ -89,17 +94,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/providers/Microsoft.GuestConfiguration/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.GuestConfiguration/operations"} # type: ignore 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..e622ad7e601e 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,60 +6,39 @@ # 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 SystemData +from ._models_py3 import VMInfo +from ._models_py3 import VMSSVMInfo + from ._guest_configuration_client_enums import ( ActionAfterReboot, AssignmentType, ComplianceStatus, ConfigurationMode, + CreatedByType, Kind, ProvisioningState, Type, @@ -88,11 +67,14 @@ 'OperationList', 'ProxyResource', 'Resource', + 'SystemData', 'VMInfo', + 'VMSSVMInfo', 'ActionAfterReboot', 'AssignmentType', 'ComplianceStatus', 'ConfigurationMode', + 'CreatedByType', 'Kind', 'ProvisioningState', 'Type', 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..d025748cafdc 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,22 @@ class ConfigurationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APPLY_AND_MONITOR = "ApplyAndMonitor" APPLY_AND_AUTO_CORRECT = "ApplyAndAutoCorrect" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +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 +70,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..7062a3b4dc83 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 @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -21,8 +22,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 +41,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 +60,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 +76,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 +110,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 +150,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 +178,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 +202,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 +227,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 +264,8 @@ def __init__( self, **kwargs ): + """ + """ super(AssignmentReportResourceComplianceReason, self).__init__(**kwargs) self.phrase = None self.code = None @@ -270,6 +296,8 @@ def __init__( self, **kwargs ): + """ + """ super(ConfigurationInfo, self).__init__(**kwargs) self.name = None self.version = None @@ -278,10 +306,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 +324,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,34 +338,45 @@ 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 + Variables are only populated by the server, and will be ignored when sending a request. + + :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 """ + _validation = { + 'configuration_mode': {'readonly': True}, + 'allow_module_overwrite': {'readonly': True}, + 'action_after_reboot': {'readonly': True}, + 'refresh_frequency_mins': {'readonly': True}, + 'reboot_if_needed': {'readonly': True}, + 'configuration_mode_frequency_mins': {'readonly': True}, + } + _attribute_map = { 'configuration_mode': {'key': 'configurationMode', 'type': 'str'}, 'allow_module_overwrite': {'key': 'allowModuleOverwrite', 'type': 'bool'}, @@ -343,29 +388,24 @@ class ConfigurationSetting(msrest.serialization.Model): def __init__( self, - *, - configuration_mode: Optional[Union[str, "ConfigurationMode"]] = None, - allow_module_overwrite: Optional[bool] = None, - action_after_reboot: Optional[Union[str, "ActionAfterReboot"]] = None, - refresh_frequency_mins: Optional[float] = 30, - reboot_if_needed: Optional[bool] = None, - configuration_mode_frequency_mins: Optional[float] = 15, **kwargs ): + """ + """ super(ConfigurationSetting, self).__init__(**kwargs) - self.configuration_mode = configuration_mode - self.allow_module_overwrite = allow_module_overwrite - self.action_after_reboot = action_after_reboot - self.refresh_frequency_mins = refresh_frequency_mins - self.reboot_if_needed = reboot_if_needed - self.configuration_mode_frequency_mins = configuration_mode_frequency_mins + self.configuration_mode = None + self.allow_module_overwrite = None + self.action_after_reboot = None + self.refresh_frequency_mins = None + self.reboot_if_needed = None + self.configuration_mode_frequency_mins = None 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 +418,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 +429,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 +447,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 +465,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 +492,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 +512,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 +539,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,19 +555,23 @@ 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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.guestconfig.models.SystemData """ _validation = { 'id': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -514,6 +580,7 @@ class GuestConfigurationAssignment(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'GuestConfigurationAssignmentProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -524,15 +591,24 @@ 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 + self.system_data = 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] + :ivar value: Result of the list guest configuration assignment operation. + :vartype value: list[~azure.mgmt.guestconfig.models.GuestConfigurationAssignment] """ _attribute_map = { @@ -545,6 +621,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 +636,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,16 +645,21 @@ 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 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 values include: "Succeeded", "Failed", "Canceled", "Created". :vartype provisioning_state: str or ~azure.mgmt.guestconfig.models.ProvisioningState + :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] """ _validation = { @@ -582,8 +667,10 @@ class GuestConfigurationAssignmentProperties(msrest.serialization.Model): 'compliance_status': {'readonly': True}, 'last_compliance_status_checked': {'readonly': True}, 'latest_report_id': {'readonly': True}, + 'parameter_hash': {'readonly': True}, 'assignment_hash': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'resource_type': {'readonly': True}, } _attribute_map = { @@ -592,10 +679,13 @@ 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'}, 'latest_assignment_report': {'key': 'latestAssignmentReport', 'type': 'AssignmentReport'}, 'context': {'key': 'context', 'type': 'str'}, 'assignment_hash': {'key': 'assignmentHash', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'vmss_vm_list': {'key': 'vmssVMList', 'type': '[VMSSVMInfo]'}, } def __init__( @@ -604,18 +694,33 @@ def __init__( guest_configuration: Optional["GuestConfigurationNavigation"] = None, latest_assignment_report: Optional["AssignmentReport"] = None, context: Optional[str] = None, + vmss_vm_list: Optional[List["VMSSVMInfo"]] = None, **kwargs ): + """ + :keyword guest_configuration: The guest configuration to assign. + :paramtype guest_configuration: ~azure.mgmt.guestconfig.models.GuestConfigurationNavigation + :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 + :keyword vmss_vm_list: The list of VM Compliance data for VMSS. + :paramtype vmss_vm_list: list[~azure.mgmt.guestconfig.models.VMSSVMInfo] + """ 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.latest_assignment_report = latest_assignment_report self.context = context self.assignment_hash = None self.provisioning_state = None + self.resource_type = None + self.vmss_vm_list = vmss_vm_list class GuestConfigurationAssignmentReport(msrest.serialization.Model): @@ -628,8 +733,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 +755,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 +769,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 +784,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 +804,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 +825,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 +836,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 +847,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 +863,51 @@ 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 assignment_source: Specifies the origin of the configuration. + :vartype assignment_source: str + :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 = { + 'assignment_source': {'readonly': True}, + 'content_type': {'readonly': True}, + 'configuration_setting': {'readonly': True}, + } + _attribute_map = { 'kind': {'key': 'kind', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, @@ -769,7 +915,10 @@ class GuestConfigurationNavigation(msrest.serialization.Model): 'content_uri': {'key': 'contentUri', 'type': 'str'}, 'content_hash': {'key': 'contentHash', 'type': 'str'}, 'assignment_type': {'key': 'assignmentType', 'type': 'str'}, + 'assignment_source': {'key': 'assignmentSource', '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 +932,34 @@ def __init__( content_hash: Optional[str] = None, assignment_type: Optional[Union[str, "AssignmentType"]] = None, configuration_parameter: Optional[List["ConfigurationParameter"]] = None, - configuration_setting: Optional["ConfigurationSetting"] = None, + configuration_protected_parameter: Optional[List["ConfigurationParameter"]] = 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] + """ super(GuestConfigurationNavigation, self).__init__(**kwargs) self.kind = kind self.name = name @@ -793,20 +967,23 @@ def __init__( self.content_uri = content_uri self.content_hash = content_hash self.assignment_type = assignment_type + self.assignment_source = None + self.content_type = None self.configuration_parameter = configuration_parameter - self.configuration_setting = configuration_setting + self.configuration_protected_parameter = configuration_protected_parameter + self.configuration_setting = None 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 +1000,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 +1018,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 +1044,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 +1064,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,10 +1078,78 @@ 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 +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.guestconfig.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.guestconfig.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.guestconfig.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.guestconfig.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class VMInfo(msrest.serialization.Model): """Information about the VM. @@ -911,6 +1175,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/__init__.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/__init__.py index 9ec9e96e98e5..63baf4a4a875 100644 --- a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/__init__.py +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/__init__.py @@ -10,6 +10,8 @@ from ._guest_configuration_assignment_reports_operations import GuestConfigurationAssignmentReportsOperations from ._guest_configuration_hcrp_assignments_operations import GuestConfigurationHCRPAssignmentsOperations from ._guest_configuration_hcrp_assignment_reports_operations import GuestConfigurationHCRPAssignmentReportsOperations +from ._guest_configuration_assignments_vmss_operations import GuestConfigurationAssignmentsVMSSOperations +from ._guest_configuration_assignment_reports_vmss_operations import GuestConfigurationAssignmentReportsVMSSOperations from ._operations import Operations __all__ = [ @@ -17,5 +19,7 @@ 'GuestConfigurationAssignmentReportsOperations', 'GuestConfigurationHCRPAssignmentsOperations', 'GuestConfigurationHCRPAssignmentReportsOperations', + 'GuestConfigurationAssignmentsVMSSOperations', + 'GuestConfigurationAssignmentReportsVMSSOperations', 'Operations', ] 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..b2d38d974456 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,101 @@ # 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 warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + 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") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + 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}") # pylint: disable=line-too-long + 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 +124,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 +150,31 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +183,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 + 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 +216,32 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +250,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 + + 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_assignment_reports_vmss_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_vmss_operations.py new file mode 100644 index 000000000000..a1205c4a268b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignment_reports_vmss_operations.py @@ -0,0 +1,282 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +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( + subscription_id: str, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "vmssName": _SERIALIZER.url("vmss_name", vmss_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vmss_name: str, + name: str, + id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{id}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "vmssName": _SERIALIZER.url("vmss_name", vmss_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "id": _SERIALIZER.url("id", 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 + ) + +class GuestConfigurationAssignmentReportsVMSSOperations(object): + """GuestConfigurationAssignmentReportsVMSSOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.guestconfig.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentReportList"]: + """List all reports for the VMSS guest configuration assignment, latest report first. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestConfigurationAssignmentReportList or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReportList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentReportList"] + 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_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + 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("GuestConfigurationAssignmentReportList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + vmss_name: str, + name: str, + id: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignmentReport": + """Get a report for the VMSS guest configuration assignment, by reportId. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :param id: The GUID for the guest configuration assignment report. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignmentReport, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignmentReport + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentReport"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + id=id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestConfigurationAssignmentReport', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{id}"} # 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..72b8b3804d78 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,249 @@ # 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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models 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: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments") # pylint: disable=line-too-long + 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 +272,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 +301,35 @@ 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 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 +342,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 + 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 +372,31 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +405,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 - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,48 +435,199 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + 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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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, + api_version=api_version, + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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, + api_version=api_version, + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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,45 +635,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -307,17 +685,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_vmss_operations.py b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_vmss_operations.py new file mode 100644 index 000000000000..73f466fd43e8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/operations/_guest_configuration_assignments_vmss_operations.py @@ -0,0 +1,372 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +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_get_request( + subscription_id: str, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "vmssName": _SERIALIZER.url("vmss_name", vmss_name, 'str'), + "name": _SERIALIZER.url("name", 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( + subscription_id: str, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "vmssName": _SERIALIZER.url("vmss_name", vmss_name, 'str'), + "name": _SERIALIZER.url("name", 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, + vmss_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmssName": _SERIALIZER.url("vmss_name", vmss_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 GuestConfigurationAssignmentsVMSSOperations(object): + """GuestConfigurationAssignmentsVMSSOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.guestconfig.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> "_models.GuestConfigurationAssignment": + """Get information about a guest configuration assignment for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}"} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + vmss_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.GuestConfigurationAssignment"]: + """Delete a guest configuration assignment for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_name: str + :param name: The guest configuration assignment name. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.guestconfig.models.GuestConfigurationAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GuestConfigurationAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vmss_name=vmss_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vmss_name: str, + **kwargs: Any + ) -> Iterable["_models.GuestConfigurationAssignmentList"]: + """List all guest configuration assignments for VMSS. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param vmss_name: The name of the virtual machine scale set. + :type vmss_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 + """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + + 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_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vmss_name=vmss_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + vmss_name=vmss_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore 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..d528d3a14a95 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,101 @@ # 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 warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + 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") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + 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}") # pylint: disable=line-too-long + 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 +124,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 +150,31 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +183,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 + 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 +216,32 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +250,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 + + 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..60857532ad7c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,183 @@ # 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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models 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: + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments") # pylint: disable=line-too-long + 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 +206,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 +235,35 @@ 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 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 +276,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 + 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 +306,31 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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 +339,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 - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,48 +369,46 @@ 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') + api_version = kwargs.pop('api_version', "2022-01-25") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: 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: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + 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,45 +416,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestConfigurationAssignmentList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -307,17 +466,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments"} # type: ignore 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..da7637766634 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models 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 = kwargs.pop('api_version', "2022-01-25") # type: str + + 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 +73,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 @@ -57,35 +85,36 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.guestconfig.models.OperationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-25") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] error_map = { 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( + api_version=api_version, + 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( + api_version=api_version, + 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) @@ -94,17 +123,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - 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 ) - list.metadata = {'url': '/providers/Microsoft.GuestConfiguration/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.GuestConfiguration/operations"} # type: ignore