From 6e5f464c9265acc78740b1cf37dbd28ac2045d20 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 20 Apr 2021 06:24:30 +0000 Subject: [PATCH] CodeGen from PR 13982 in Azure/azure-rest-api-specs maintenance readme t2 config (#13982) * maintenance readme t2 config * readme t1 config --- .../azure-mgmt-maintenance/MANIFEST.in | 1 + .../azure-mgmt-maintenance/_meta.json | 8 + .../azure/mgmt/maintenance/_configuration.py | 2 +- .../mgmt/maintenance/_maintenance_client.py | 34 +++ .../azure/mgmt/maintenance/_metadata.json | 111 ++++++++ .../azure/mgmt/maintenance/_version.py | 3 +- .../mgmt/maintenance/aio/_configuration.py | 2 +- .../maintenance/aio/_maintenance_client.py | 33 +++ .../maintenance/aio/operations/__init__.py | 6 + ...ly_update_for_resource_group_operations.py | 115 ++++++++ .../operations/_apply_updates_operations.py | 92 ++++++- .../_configuration_assignments_operations.py | 206 +++++++++++++-- ...ignments_within_subscription_operations.py | 111 ++++++++ ...gurations_for_resource_group_operations.py | 115 ++++++++ .../_maintenance_configurations_operations.py | 32 +-- .../maintenance/aio/operations/_operations.py | 4 +- ...c_maintenance_configurations_operations.py | 8 +- .../aio/operations/_updates_operations.py | 10 +- .../azure/mgmt/maintenance/models/__init__.py | 24 ++ .../models/_maintenance_client_enums.py | 28 +- .../azure/mgmt/maintenance/models/_models.py | 219 +++++++++++++++- .../mgmt/maintenance/models/_models_py3.py | 248 +++++++++++++++++- .../mgmt/maintenance/operations/__init__.py | 6 + ...ly_update_for_resource_group_operations.py | 120 +++++++++ .../operations/_apply_updates_operations.py | 93 ++++++- .../_configuration_assignments_operations.py | 208 +++++++++++++-- ...ignments_within_subscription_operations.py | 116 ++++++++ ...gurations_for_resource_group_operations.py | 120 +++++++++ .../_maintenance_configurations_operations.py | 32 +-- .../maintenance/operations/_operations.py | 4 +- ...c_maintenance_configurations_operations.py | 8 +- .../operations/_updates_operations.py | 10 +- 32 files changed, 2004 insertions(+), 125 deletions(-) create mode 100644 sdk/maintenance/azure-mgmt-maintenance/_meta.json create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_metadata.json create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_update_for_resource_group_operations.py create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_within_subscription_operations.py create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_for_resource_group_operations.py create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_update_for_resource_group_operations.py create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_within_subscription_operations.py create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_for_resource_group_operations.py diff --git a/sdk/maintenance/azure-mgmt-maintenance/MANIFEST.in b/sdk/maintenance/azure-mgmt-maintenance/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/MANIFEST.in +++ b/sdk/maintenance/azure-mgmt-maintenance/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/maintenance/azure-mgmt-maintenance/_meta.json b/sdk/maintenance/azure-mgmt-maintenance/_meta.json new file mode 100644 index 000000000000..54e3688d7fee --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "eb6d68be864349a8fd33d261e90bb2756e904e82", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maintenance/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0", + "readme": "specification/maintenance/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py index 82b6c4a4eeca..8771beb8154a 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-maintenance/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py index b1433f682186..c31c1c42f71e 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py @@ -16,12 +16,16 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MaintenanceClientConfiguration from .operations import PublicMaintenanceConfigurationsOperations from .operations import ApplyUpdatesOperations from .operations import ConfigurationAssignmentsOperations from .operations import MaintenanceConfigurationsOperations +from .operations import MaintenanceConfigurationsForResourceGroupOperations +from .operations import ApplyUpdateForResourceGroupOperations +from .operations import ConfigurationAssignmentsWithinSubscriptionOperations from .operations import Operations from .operations import UpdatesOperations from . import models @@ -38,6 +42,12 @@ class MaintenanceClient(object): :vartype configuration_assignments: azure.mgmt.maintenance.operations.ConfigurationAssignmentsOperations :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations :vartype maintenance_configurations: azure.mgmt.maintenance.operations.MaintenanceConfigurationsOperations + :ivar maintenance_configurations_for_resource_group: MaintenanceConfigurationsForResourceGroupOperations operations + :vartype maintenance_configurations_for_resource_group: azure.mgmt.maintenance.operations.MaintenanceConfigurationsForResourceGroupOperations + :ivar apply_update_for_resource_group: ApplyUpdateForResourceGroupOperations operations + :vartype apply_update_for_resource_group: azure.mgmt.maintenance.operations.ApplyUpdateForResourceGroupOperations + :ivar configuration_assignments_within_subscription: ConfigurationAssignmentsWithinSubscriptionOperations operations + :vartype configuration_assignments_within_subscription: azure.mgmt.maintenance.operations.ConfigurationAssignmentsWithinSubscriptionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.maintenance.operations.Operations :ivar updates: UpdatesOperations operations @@ -75,11 +85,35 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) + self.maintenance_configurations_for_resource_group = MaintenanceConfigurationsForResourceGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apply_update_for_resource_group = ApplyUpdateForResourceGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_assignments_within_subscription = ConfigurationAssignmentsWithinSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.updates = UpdatesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + def close(self): # type: () -> None self._client.close() diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_metadata.json b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_metadata.json new file mode 100644 index 000000000000..e11de784ac6c --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_metadata.json @@ -0,0 +1,111 @@ +{ + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-01-preview"], + "client": { + "name": "MaintenanceClient", + "filename": "_maintenance_client", + "description": "Maintenance Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": 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\": [\"MaintenanceClientConfiguration\"]}}, \"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\": [\"MaintenanceClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_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\"]}}}" + }, + "operation_groups": { + "public_maintenance_configurations": "PublicMaintenanceConfigurationsOperations", + "apply_updates": "ApplyUpdatesOperations", + "configuration_assignments": "ConfigurationAssignmentsOperations", + "maintenance_configurations": "MaintenanceConfigurationsOperations", + "maintenance_configurations_for_resource_group": "MaintenanceConfigurationsForResourceGroupOperations", + "apply_update_for_resource_group": "ApplyUpdateForResourceGroupOperations", + "configuration_assignments_within_subscription": "ConfigurationAssignmentsWithinSubscriptionOperations", + "operations": "Operations", + "updates": "UpdatesOperations" + } +} \ No newline at end of file diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_version.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_version.py index 515f51c112dd..59deb8c7263b 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_version.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_version.py @@ -6,5 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" - +VERSION = "1.1.0" diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_configuration.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_configuration.py index 33236b664fb2..9e3c0af06fba 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_configuration.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_configuration.py @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-maintenance/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_maintenance_client.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_maintenance_client.py index 2bc9b351b7e4..4d34c4f687a2 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_maintenance_client.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/_maintenance_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -20,6 +21,9 @@ from .operations import ApplyUpdatesOperations from .operations import ConfigurationAssignmentsOperations from .operations import MaintenanceConfigurationsOperations +from .operations import MaintenanceConfigurationsForResourceGroupOperations +from .operations import ApplyUpdateForResourceGroupOperations +from .operations import ConfigurationAssignmentsWithinSubscriptionOperations from .operations import Operations from .operations import UpdatesOperations from .. import models @@ -36,6 +40,12 @@ class MaintenanceClient(object): :vartype configuration_assignments: azure.mgmt.maintenance.aio.operations.ConfigurationAssignmentsOperations :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations :vartype maintenance_configurations: azure.mgmt.maintenance.aio.operations.MaintenanceConfigurationsOperations + :ivar maintenance_configurations_for_resource_group: MaintenanceConfigurationsForResourceGroupOperations operations + :vartype maintenance_configurations_for_resource_group: azure.mgmt.maintenance.aio.operations.MaintenanceConfigurationsForResourceGroupOperations + :ivar apply_update_for_resource_group: ApplyUpdateForResourceGroupOperations operations + :vartype apply_update_for_resource_group: azure.mgmt.maintenance.aio.operations.ApplyUpdateForResourceGroupOperations + :ivar configuration_assignments_within_subscription: ConfigurationAssignmentsWithinSubscriptionOperations operations + :vartype configuration_assignments_within_subscription: azure.mgmt.maintenance.aio.operations.ConfigurationAssignmentsWithinSubscriptionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.maintenance.aio.operations.Operations :ivar updates: UpdatesOperations operations @@ -72,11 +82,34 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) + self.maintenance_configurations_for_resource_group = MaintenanceConfigurationsForResourceGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apply_update_for_resource_group = ApplyUpdateForResourceGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_assignments_within_subscription = ConfigurationAssignmentsWithinSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.updates = UpdatesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + async def close(self) -> None: await self._client.close() diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/__init__.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/__init__.py index 4c08356e4478..9073f0a77635 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/__init__.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/__init__.py @@ -10,6 +10,9 @@ from ._apply_updates_operations import ApplyUpdatesOperations from ._configuration_assignments_operations import ConfigurationAssignmentsOperations from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._maintenance_configurations_for_resource_group_operations import MaintenanceConfigurationsForResourceGroupOperations +from ._apply_update_for_resource_group_operations import ApplyUpdateForResourceGroupOperations +from ._configuration_assignments_within_subscription_operations import ConfigurationAssignmentsWithinSubscriptionOperations from ._operations import Operations from ._updates_operations import UpdatesOperations @@ -18,6 +21,9 @@ 'ApplyUpdatesOperations', 'ConfigurationAssignmentsOperations', 'MaintenanceConfigurationsOperations', + 'MaintenanceConfigurationsForResourceGroupOperations', + 'ApplyUpdateForResourceGroupOperations', + 'ConfigurationAssignmentsWithinSubscriptionOperations', 'Operations', 'UpdatesOperations', ] diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_update_for_resource_group_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_update_for_resource_group_operations.py new file mode 100644 index 000000000000..41746d50939a --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_update_for_resource_group_operations.py @@ -0,0 +1,115 @@ +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplyUpdateForResourceGroupOperations: + """ApplyUpdateForResourceGroupOperations 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.maintenance.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 + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ListApplyUpdate"]: + """Get Configuration records within a subscription and resource group. + + Get Configuration records within a subscription and resource group. + + :param resource_group_name: 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 ListApplyUpdate or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.maintenance.models.ListApplyUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplyUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListApplyUpdate', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.Maintenance/applyUpdates'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_updates_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_updates_operations.py index 3465fa4af30b..a68417c4ac73 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_updates_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_apply_updates_operations.py @@ -5,9 +5,10 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -79,7 +80,7 @@ async def get_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -110,7 +111,8 @@ async def get_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -153,7 +155,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -182,7 +184,8 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -228,7 +231,7 @@ async def create_or_update_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -258,7 +261,8 @@ async def create_or_update_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -298,7 +302,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -326,7 +330,8 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -335,3 +340,72 @@ async def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.ListApplyUpdate"]: + """Get Configuration records within a subscription. + + Get Configuration records within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListApplyUpdate or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.maintenance.models.ListApplyUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplyUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListApplyUpdate', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_operations.py index 8cb0e6e3cde1..aa899c38483d 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_operations.py @@ -41,6 +41,87 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + async def get_parent( + self, + resource_group_name: str, + provider_name: str, + resource_parent_type: str, + resource_parent_name: str, + resource_type: str, + resource_name: str, + configuration_assignment_name: str, + **kwargs + ) -> "_models.ConfigurationAssignment": + """Get configuration assignment. + + Get configuration for resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provider_name: Resource provider name. + :type provider_name: str + :param resource_parent_type: Resource parent type. + :type resource_parent_type: str + :param resource_parent_name: Resource parent identifier. + :type resource_parent_name: str + :param resource_type: Resource type. + :type resource_type: str + :param resource_name: Resource identifier. + :type resource_name: str + :param configuration_assignment_name: Configuration assignment name. + :type configuration_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_parent.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceParentType': self._serialize.url("resource_parent_type", resource_parent_type, 'str'), + 'resourceParentName': self._serialize.url("resource_parent_name", resource_parent_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'configurationAssignmentName': self._serialize.url("configuration_assignment_name", configuration_assignment_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) + 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.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + async def create_or_update_parent( self, resource_group_name: str, @@ -83,7 +164,7 @@ async def create_or_update_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -119,7 +200,8 @@ async def create_or_update_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -139,7 +221,7 @@ async def delete_parent( resource_name: str, configuration_assignment_name: str, **kwargs - ) -> "_models.ConfigurationAssignment": + ) -> Optional["_models.ConfigurationAssignment"]: """Unregister configuration for resource. Unregister configuration for resource. @@ -160,15 +242,15 @@ async def delete_parent( :type configuration_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationAssignment, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -197,9 +279,85 @@ async def delete_parent( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + provider_name: str, + resource_type: str, + resource_name: str, + configuration_assignment_name: str, + **kwargs + ) -> "_models.ConfigurationAssignment": + """Get configuration assignment. + + Get configuration for resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provider_name: Resource provider name. + :type provider_name: str + :param resource_type: Resource type. + :type resource_type: str + :param resource_name: Resource identifier. + :type resource_name: str + :param configuration_assignment_name: Configuration assignment name. + :type configuration_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'configurationAssignmentName': self._serialize.url("configuration_assignment_name", configuration_assignment_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) + 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -207,7 +365,7 @@ async def delete_parent( return cls(pipeline_response, deserialized, {}) return deserialized - delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore async def create_or_update( self, @@ -245,7 +403,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -279,7 +437,8 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -297,7 +456,7 @@ async def delete( resource_name: str, configuration_assignment_name: str, **kwargs - ) -> "_models.ConfigurationAssignment": + ) -> Optional["_models.ConfigurationAssignment"]: """Unregister configuration for resource. Unregister configuration for resource. @@ -314,15 +473,15 @@ async def delete( :type configuration_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationAssignment, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -349,11 +508,14 @@ async def delete( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -397,7 +559,7 @@ def list_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -443,8 +605,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -483,7 +646,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -527,8 +690,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_within_subscription_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_within_subscription_operations.py new file mode 100644 index 000000000000..811a6d62914e --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_configuration_assignments_within_subscription_operations.py @@ -0,0 +1,111 @@ +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationAssignmentsWithinSubscriptionOperations: + """ConfigurationAssignmentsWithinSubscriptionOperations 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.maintenance.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 + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.ListConfigurationAssignmentsResult"]: + """Get configuration assignment within a subscription. + + Get configuration assignment within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListConfigurationAssignmentsResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.maintenance.models.ListConfigurationAssignmentsResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListConfigurationAssignmentsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListConfigurationAssignmentsResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_for_resource_group_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_for_resource_group_operations.py new file mode 100644 index 000000000000..b58d5e411824 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_for_resource_group_operations.py @@ -0,0 +1,115 @@ +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MaintenanceConfigurationsForResourceGroupOperations: + """MaintenanceConfigurationsForResourceGroupOperations 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.maintenance.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 + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ListMaintenanceConfigurationsResult"]: + """Get Configuration records within a subscription and resource group. + + Get Configuration records within a subscription and resource group. + + :param resource_group_name: 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 ListMaintenanceConfigurationsResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.maintenance.models.ListMaintenanceConfigurationsResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListMaintenanceConfigurationsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListMaintenanceConfigurationsResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.Maintenance/maintenanceConfigurations'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_operations.py index 88186a888a97..d0ab25e28dcf 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_maintenance_configurations_operations.py @@ -65,7 +65,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -91,7 +91,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -129,7 +129,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -160,7 +160,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -176,7 +176,7 @@ async def delete( resource_group_name: str, resource_name: str, **kwargs - ) -> "_models.MaintenanceConfiguration": + ) -> Optional["_models.MaintenanceConfiguration"]: """Delete Configuration record. Delete Configuration record. @@ -187,15 +187,15 @@ async def delete( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MaintenanceConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.MaintenanceConfiguration + :rtype: ~azure.mgmt.maintenance.models.MaintenanceConfiguration or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MaintenanceConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -219,12 +219,14 @@ async def delete( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -259,7 +261,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -290,7 +292,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -319,7 +321,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -359,7 +361,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_operations.py index a3b81de5124e..57eb3c895a82 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_operations.py @@ -59,7 +59,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -95,7 +95,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_public_maintenance_configurations_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_public_maintenance_configurations_operations.py index 34c8eabc0bb0..74d0def1fbe6 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_public_maintenance_configurations_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_public_maintenance_configurations_operations.py @@ -59,7 +59,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -99,7 +99,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -131,7 +131,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -156,7 +156,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_updates_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_updates_operations.py index 163e87bcf5ca..41152abe7ee6 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_updates_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/aio/operations/_updates_operations.py @@ -77,7 +77,7 @@ def list_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -123,8 +123,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -163,7 +164,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -207,8 +208,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/__init__.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/__init__.py index 56f8e539b549..d121e9f01fd6 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/__init__.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/__init__.py @@ -10,6 +10,10 @@ from ._models_py3 import ApplyUpdate from ._models_py3 import ConfigurationAssignment from ._models_py3 import ErrorDetails + from ._models_py3 import InputLinuxParameters + from ._models_py3 import InputPatchConfiguration + from ._models_py3 import InputWindowsParameters + from ._models_py3 import ListApplyUpdate from ._models_py3 import ListConfigurationAssignmentsResult from ._models_py3 import ListMaintenanceConfigurationsResult from ._models_py3 import ListUpdatesResult @@ -19,11 +23,17 @@ from ._models_py3 import OperationInfo from ._models_py3 import OperationsListResult from ._models_py3 import Resource + from ._models_py3 import SystemData + from ._models_py3 import TaskProperties from ._models_py3 import Update except (SyntaxError, ImportError): from ._models import ApplyUpdate # type: ignore from ._models import ConfigurationAssignment # type: ignore from ._models import ErrorDetails # type: ignore + from ._models import InputLinuxParameters # type: ignore + from ._models import InputPatchConfiguration # type: ignore + from ._models import InputWindowsParameters # type: ignore + from ._models import ListApplyUpdate # type: ignore from ._models import ListConfigurationAssignmentsResult # type: ignore from ._models import ListMaintenanceConfigurationsResult # type: ignore from ._models import ListUpdatesResult # type: ignore @@ -33,11 +43,16 @@ from ._models import OperationInfo # type: ignore from ._models import OperationsListResult # type: ignore from ._models import Resource # type: ignore + from ._models import SystemData # type: ignore + from ._models import TaskProperties # type: ignore from ._models import Update # type: ignore from ._maintenance_client_enums import ( + CreatedByType, ImpactType, MaintenanceScope, + RebootOptions, + TaskScope, UpdateStatus, Visibility, ) @@ -46,6 +61,10 @@ 'ApplyUpdate', 'ConfigurationAssignment', 'ErrorDetails', + 'InputLinuxParameters', + 'InputPatchConfiguration', + 'InputWindowsParameters', + 'ListApplyUpdate', 'ListConfigurationAssignmentsResult', 'ListMaintenanceConfigurationsResult', 'ListUpdatesResult', @@ -55,9 +74,14 @@ 'OperationInfo', 'OperationsListResult', 'Resource', + 'SystemData', + 'TaskProperties', 'Update', + 'CreatedByType', 'ImpactType', 'MaintenanceScope', + 'RebootOptions', + 'TaskScope', 'UpdateStatus', 'Visibility', ] diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py index ed541885949a..5621ac81ac41 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py @@ -26,6 +26,15 @@ def __getattr__(cls, name): raise AttributeError(name) +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 ImpactType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The impact type """ @@ -39,16 +48,29 @@ class MaintenanceScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets maintenanceScope of the configuration """ - ALL = "All" HOST = "Host" - RESOURCE = "Resource" - IN_RESOURCE = "InResource" OS_IMAGE = "OSImage" EXTENSION = "Extension" IN_GUEST_PATCH = "InGuestPatch" SQLDB = "SQLDB" SQL_MANAGED_INSTANCE = "SQLManagedInstance" +class RebootOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Possible reboot preference as defined by the user based on which it would be decided to reboot + the machine or not after the patch operation is completed. + """ + + NEVER_REBOOT = "NeverReboot" + REBOOT_IF_REQUIRED = "RebootIfRequired" + ALWAYS_REBOOT = "AlwaysReboot" + +class TaskScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Global Task execute once when schedule trigger. Resource task execute for each VM. + """ + + GLOBAL_ENUM = "Global" + RESOURCE = "Resource" + class UpdateStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The status """ diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models.py index ed11ad6e888a..4231d48e233b 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models.py @@ -21,18 +21,23 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -43,6 +48,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None class ApplyUpdate(Resource): @@ -56,6 +62,9 @@ class ApplyUpdate(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param status: The status. Possible values include: "Pending", "InProgress", "Completed", "RetryNow", "RetryLater". :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus @@ -69,12 +78,14 @@ class ApplyUpdate(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, @@ -101,6 +112,9 @@ class ConfigurationAssignment(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param location: Location of the resource. :type location: str :param maintenance_configuration_id: The maintenance configuration Id. @@ -113,12 +127,14 @@ class ConfigurationAssignment(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, @@ -158,6 +174,120 @@ def __init__( self.message = kwargs.get('message', None) +class InputLinuxParameters(msrest.serialization.Model): + """Input properties for patching a Linux machine. + + :param package_name_masks_to_exclude: Package names to be excluded for patching. + :type package_name_masks_to_exclude: list[str] + :param package_name_masks_to_include: Package names to be included for patching. + :type package_name_masks_to_include: list[str] + :param classifications_to_include: Classification category of patches to be patched. + :type classifications_to_include: list[str] + """ + + _attribute_map = { + 'package_name_masks_to_exclude': {'key': 'packageNameMasksToExclude', 'type': '[str]'}, + 'package_name_masks_to_include': {'key': 'packageNameMasksToInclude', 'type': '[str]'}, + 'classifications_to_include': {'key': 'classificationsToInclude', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(InputLinuxParameters, self).__init__(**kwargs) + self.package_name_masks_to_exclude = kwargs.get('package_name_masks_to_exclude', None) + self.package_name_masks_to_include = kwargs.get('package_name_masks_to_include', None) + self.classifications_to_include = kwargs.get('classifications_to_include', None) + + +class InputPatchConfiguration(msrest.serialization.Model): + """Input configuration for a patch run. + + :param reboot_setting: Possible reboot preference as defined by the user based on which it + would be decided to reboot the machine or not after the patch operation is completed. Possible + values include: "NeverReboot", "RebootIfRequired", "AlwaysReboot". + :type reboot_setting: str or ~azure.mgmt.maintenance.models.RebootOptions + :param windows_parameters: Input parameters specific to patching a Windows machine. For Linux + machines, do not pass this property. + :type windows_parameters: ~azure.mgmt.maintenance.models.InputWindowsParameters + :param linux_parameters: Input parameters specific to patching Linux machine. For Windows + machines, do not pass this property. + :type linux_parameters: ~azure.mgmt.maintenance.models.InputLinuxParameters + :param pre_tasks: List of pre tasks. e.g. [{'source' :'runbook', 'taskScope': 'Global', + 'parameters': { 'arg1': 'value1'}}]. + :type pre_tasks: list[~azure.mgmt.maintenance.models.TaskProperties] + :param post_tasks: List of post tasks. e.g. [{'source' :'runbook', 'taskScope': 'Resource', + 'parameters': { 'arg1': 'value1'}}]. + :type post_tasks: list[~azure.mgmt.maintenance.models.TaskProperties] + """ + + _attribute_map = { + 'reboot_setting': {'key': 'rebootSetting', 'type': 'str'}, + 'windows_parameters': {'key': 'windowsParameters', 'type': 'InputWindowsParameters'}, + 'linux_parameters': {'key': 'linuxParameters', 'type': 'InputLinuxParameters'}, + 'pre_tasks': {'key': 'tasks.preTasks', 'type': '[TaskProperties]'}, + 'post_tasks': {'key': 'tasks.postTasks', 'type': '[TaskProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(InputPatchConfiguration, self).__init__(**kwargs) + self.reboot_setting = kwargs.get('reboot_setting', None) + self.windows_parameters = kwargs.get('windows_parameters', None) + self.linux_parameters = kwargs.get('linux_parameters', None) + self.pre_tasks = kwargs.get('pre_tasks', None) + self.post_tasks = kwargs.get('post_tasks', None) + + +class InputWindowsParameters(msrest.serialization.Model): + """Input properties for patching a Windows machine. + + :param kb_numbers_to_exclude: Windows KBID to be excluded for patching. + :type kb_numbers_to_exclude: list[str] + :param kb_numbers_to_include: Windows KBID to be included for patching. + :type kb_numbers_to_include: list[str] + :param classifications_to_include: Classification category of patches to be patched. + :type classifications_to_include: list[str] + """ + + _attribute_map = { + 'kb_numbers_to_exclude': {'key': 'kbNumbersToExclude', 'type': '[str]'}, + 'kb_numbers_to_include': {'key': 'kbNumbersToInclude', 'type': '[str]'}, + 'classifications_to_include': {'key': 'classificationsToInclude', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(InputWindowsParameters, self).__init__(**kwargs) + self.kb_numbers_to_exclude = kwargs.get('kb_numbers_to_exclude', None) + self.kb_numbers_to_include = kwargs.get('kb_numbers_to_include', None) + self.classifications_to_include = kwargs.get('classifications_to_include', None) + + +class ListApplyUpdate(msrest.serialization.Model): + """Response for ApplyUpdate list. + + :param value: The list of apply updates. + :type value: list[~azure.mgmt.maintenance.models.ApplyUpdate] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplyUpdate]'}, + } + + def __init__( + self, + **kwargs + ): + super(ListApplyUpdate, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class ListConfigurationAssignmentsResult(msrest.serialization.Model): """Response for ConfigurationAssignments list. @@ -226,6 +356,9 @@ class MaintenanceConfiguration(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param location: Gets or sets location of the resource. :type location: str :param tags: A set of tags. Gets or sets tags of the resource. @@ -235,12 +368,13 @@ class MaintenanceConfiguration(Resource): :param extension_properties: Gets or sets extensionProperties of the maintenanceConfiguration. :type extension_properties: dict[str, str] :param maintenance_scope: Gets or sets maintenanceScope of the configuration. Possible values - include: "All", "Host", "Resource", "InResource", "OSImage", "Extension", "InGuestPatch", - "SQLDB", "SQLManagedInstance". + include: "Host", "OSImage", "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope :param visibility: Gets or sets the visibility of the configuration. Possible values include: "Custom", "Public". :type visibility: str or ~azure.mgmt.maintenance.models.Visibility + :param install_patches: The input parameters to be passed to the patch run operation. + :type install_patches: ~azure.mgmt.maintenance.models.InputPatchConfiguration :param start_date_time: Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. @@ -275,18 +409,21 @@ class MaintenanceConfiguration(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'namespace': {'key': 'properties.namespace', 'type': 'str'}, 'extension_properties': {'key': 'properties.extensionProperties', 'type': '{str}'}, 'maintenance_scope': {'key': 'properties.maintenanceScope', 'type': 'str'}, 'visibility': {'key': 'properties.visibility', 'type': 'str'}, + 'install_patches': {'key': 'properties.installPatches', 'type': 'InputPatchConfiguration'}, 'start_date_time': {'key': 'properties.maintenanceWindow.startDateTime', 'type': 'str'}, 'expiration_date_time': {'key': 'properties.maintenanceWindow.expirationDateTime', 'type': 'str'}, 'duration': {'key': 'properties.maintenanceWindow.duration', 'type': 'str'}, @@ -305,6 +442,7 @@ def __init__( self.extension_properties = kwargs.get('extension_properties', None) self.maintenance_scope = kwargs.get('maintenance_scope', None) self.visibility = kwargs.get('visibility', None) + self.install_patches = kwargs.get('install_patches', None) self.start_date_time = kwargs.get('start_date_time', None) self.expiration_date_time = kwargs.get('expiration_date_time', None) self.duration = kwargs.get('duration', None) @@ -342,6 +480,8 @@ class Operation(msrest.serialization.Model): :type origin: str :param properties: Properties of the operation. :type properties: object + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool """ _attribute_map = { @@ -349,6 +489,7 @@ class Operation(msrest.serialization.Model): 'display': {'key': 'display', 'type': 'OperationInfo'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'object'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, } def __init__( @@ -360,6 +501,7 @@ def __init__( self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) + self.is_data_action = kwargs.get('is_data_action', None) class OperationInfo(msrest.serialization.Model): @@ -412,11 +554,80 @@ def __init__( self.value = kwargs.get('value', None) +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.maintenance.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.maintenance.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type 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, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TaskProperties(msrest.serialization.Model): + """Task properties of the software update configuration. + + :param parameters: Gets or sets the parameters of the task. + :type parameters: dict[str, str] + :param source: Gets or sets the name of the runbook. + :type source: str + :param task_scope: Global Task execute once when schedule trigger. Resource task execute for + each VM. Possible values include: "Global", "Resource". Default value: "Global". + :type task_scope: str or ~azure.mgmt.maintenance.models.TaskScope + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': '{str}'}, + 'source': {'key': 'source', 'type': 'str'}, + 'task_scope': {'key': 'taskScope', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TaskProperties, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + self.source = kwargs.get('source', None) + self.task_scope = kwargs.get('task_scope', "Global") + + class Update(msrest.serialization.Model): """Maintenance update on a resource. - :param maintenance_scope: The impact area. Possible values include: "All", "Host", "Resource", - "InResource", "OSImage", "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". + :param maintenance_scope: The impact area. Possible values include: "Host", "OSImage", + "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope :param impact_type: The impact type. Possible values include: "None", "Freeze", "Restart", "Redeploy". diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models_py3.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models_py3.py index bcb0f2bfe45e..69fd2c420b96 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models_py3.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_models_py3.py @@ -26,18 +26,23 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -48,6 +53,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None class ApplyUpdate(Resource): @@ -61,6 +67,9 @@ class ApplyUpdate(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param status: The status. Possible values include: "Pending", "InProgress", "Completed", "RetryNow", "RetryLater". :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus @@ -74,12 +83,14 @@ class ApplyUpdate(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, @@ -110,6 +121,9 @@ class ConfigurationAssignment(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param location: Location of the resource. :type location: str :param maintenance_configuration_id: The maintenance configuration Id. @@ -122,12 +136,14 @@ class ConfigurationAssignment(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, @@ -174,6 +190,136 @@ def __init__( self.message = message +class InputLinuxParameters(msrest.serialization.Model): + """Input properties for patching a Linux machine. + + :param package_name_masks_to_exclude: Package names to be excluded for patching. + :type package_name_masks_to_exclude: list[str] + :param package_name_masks_to_include: Package names to be included for patching. + :type package_name_masks_to_include: list[str] + :param classifications_to_include: Classification category of patches to be patched. + :type classifications_to_include: list[str] + """ + + _attribute_map = { + 'package_name_masks_to_exclude': {'key': 'packageNameMasksToExclude', 'type': '[str]'}, + 'package_name_masks_to_include': {'key': 'packageNameMasksToInclude', 'type': '[str]'}, + 'classifications_to_include': {'key': 'classificationsToInclude', 'type': '[str]'}, + } + + def __init__( + self, + *, + package_name_masks_to_exclude: Optional[List[str]] = None, + package_name_masks_to_include: Optional[List[str]] = None, + classifications_to_include: Optional[List[str]] = None, + **kwargs + ): + super(InputLinuxParameters, self).__init__(**kwargs) + self.package_name_masks_to_exclude = package_name_masks_to_exclude + self.package_name_masks_to_include = package_name_masks_to_include + self.classifications_to_include = classifications_to_include + + +class InputPatchConfiguration(msrest.serialization.Model): + """Input configuration for a patch run. + + :param reboot_setting: Possible reboot preference as defined by the user based on which it + would be decided to reboot the machine or not after the patch operation is completed. Possible + values include: "NeverReboot", "RebootIfRequired", "AlwaysReboot". + :type reboot_setting: str or ~azure.mgmt.maintenance.models.RebootOptions + :param windows_parameters: Input parameters specific to patching a Windows machine. For Linux + machines, do not pass this property. + :type windows_parameters: ~azure.mgmt.maintenance.models.InputWindowsParameters + :param linux_parameters: Input parameters specific to patching Linux machine. For Windows + machines, do not pass this property. + :type linux_parameters: ~azure.mgmt.maintenance.models.InputLinuxParameters + :param pre_tasks: List of pre tasks. e.g. [{'source' :'runbook', 'taskScope': 'Global', + 'parameters': { 'arg1': 'value1'}}]. + :type pre_tasks: list[~azure.mgmt.maintenance.models.TaskProperties] + :param post_tasks: List of post tasks. e.g. [{'source' :'runbook', 'taskScope': 'Resource', + 'parameters': { 'arg1': 'value1'}}]. + :type post_tasks: list[~azure.mgmt.maintenance.models.TaskProperties] + """ + + _attribute_map = { + 'reboot_setting': {'key': 'rebootSetting', 'type': 'str'}, + 'windows_parameters': {'key': 'windowsParameters', 'type': 'InputWindowsParameters'}, + 'linux_parameters': {'key': 'linuxParameters', 'type': 'InputLinuxParameters'}, + 'pre_tasks': {'key': 'tasks.preTasks', 'type': '[TaskProperties]'}, + 'post_tasks': {'key': 'tasks.postTasks', 'type': '[TaskProperties]'}, + } + + def __init__( + self, + *, + reboot_setting: Optional[Union[str, "RebootOptions"]] = None, + windows_parameters: Optional["InputWindowsParameters"] = None, + linux_parameters: Optional["InputLinuxParameters"] = None, + pre_tasks: Optional[List["TaskProperties"]] = None, + post_tasks: Optional[List["TaskProperties"]] = None, + **kwargs + ): + super(InputPatchConfiguration, self).__init__(**kwargs) + self.reboot_setting = reboot_setting + self.windows_parameters = windows_parameters + self.linux_parameters = linux_parameters + self.pre_tasks = pre_tasks + self.post_tasks = post_tasks + + +class InputWindowsParameters(msrest.serialization.Model): + """Input properties for patching a Windows machine. + + :param kb_numbers_to_exclude: Windows KBID to be excluded for patching. + :type kb_numbers_to_exclude: list[str] + :param kb_numbers_to_include: Windows KBID to be included for patching. + :type kb_numbers_to_include: list[str] + :param classifications_to_include: Classification category of patches to be patched. + :type classifications_to_include: list[str] + """ + + _attribute_map = { + 'kb_numbers_to_exclude': {'key': 'kbNumbersToExclude', 'type': '[str]'}, + 'kb_numbers_to_include': {'key': 'kbNumbersToInclude', 'type': '[str]'}, + 'classifications_to_include': {'key': 'classificationsToInclude', 'type': '[str]'}, + } + + def __init__( + self, + *, + kb_numbers_to_exclude: Optional[List[str]] = None, + kb_numbers_to_include: Optional[List[str]] = None, + classifications_to_include: Optional[List[str]] = None, + **kwargs + ): + super(InputWindowsParameters, self).__init__(**kwargs) + self.kb_numbers_to_exclude = kb_numbers_to_exclude + self.kb_numbers_to_include = kb_numbers_to_include + self.classifications_to_include = classifications_to_include + + +class ListApplyUpdate(msrest.serialization.Model): + """Response for ApplyUpdate list. + + :param value: The list of apply updates. + :type value: list[~azure.mgmt.maintenance.models.ApplyUpdate] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplyUpdate]'}, + } + + def __init__( + self, + *, + value: Optional[List["ApplyUpdate"]] = None, + **kwargs + ): + super(ListApplyUpdate, self).__init__(**kwargs) + self.value = value + + class ListConfigurationAssignmentsResult(msrest.serialization.Model): """Response for ConfigurationAssignments list. @@ -248,6 +394,9 @@ class MaintenanceConfiguration(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.maintenance.models.SystemData :param location: Gets or sets location of the resource. :type location: str :param tags: A set of tags. Gets or sets tags of the resource. @@ -257,12 +406,13 @@ class MaintenanceConfiguration(Resource): :param extension_properties: Gets or sets extensionProperties of the maintenanceConfiguration. :type extension_properties: dict[str, str] :param maintenance_scope: Gets or sets maintenanceScope of the configuration. Possible values - include: "All", "Host", "Resource", "InResource", "OSImage", "Extension", "InGuestPatch", - "SQLDB", "SQLManagedInstance". + include: "Host", "OSImage", "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope :param visibility: Gets or sets the visibility of the configuration. Possible values include: "Custom", "Public". :type visibility: str or ~azure.mgmt.maintenance.models.Visibility + :param install_patches: The input parameters to be passed to the patch run operation. + :type install_patches: ~azure.mgmt.maintenance.models.InputPatchConfiguration :param start_date_time: Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. @@ -297,18 +447,21 @@ class MaintenanceConfiguration(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'namespace': {'key': 'properties.namespace', 'type': 'str'}, 'extension_properties': {'key': 'properties.extensionProperties', 'type': '{str}'}, 'maintenance_scope': {'key': 'properties.maintenanceScope', 'type': 'str'}, 'visibility': {'key': 'properties.visibility', 'type': 'str'}, + 'install_patches': {'key': 'properties.installPatches', 'type': 'InputPatchConfiguration'}, 'start_date_time': {'key': 'properties.maintenanceWindow.startDateTime', 'type': 'str'}, 'expiration_date_time': {'key': 'properties.maintenanceWindow.expirationDateTime', 'type': 'str'}, 'duration': {'key': 'properties.maintenanceWindow.duration', 'type': 'str'}, @@ -325,6 +478,7 @@ def __init__( extension_properties: Optional[Dict[str, str]] = None, maintenance_scope: Optional[Union[str, "MaintenanceScope"]] = None, visibility: Optional[Union[str, "Visibility"]] = None, + install_patches: Optional["InputPatchConfiguration"] = None, start_date_time: Optional[str] = None, expiration_date_time: Optional[str] = None, duration: Optional[str] = None, @@ -339,6 +493,7 @@ def __init__( self.extension_properties = extension_properties self.maintenance_scope = maintenance_scope self.visibility = visibility + self.install_patches = install_patches self.start_date_time = start_date_time self.expiration_date_time = expiration_date_time self.duration = duration @@ -378,6 +533,8 @@ class Operation(msrest.serialization.Model): :type origin: str :param properties: Properties of the operation. :type properties: object + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool """ _attribute_map = { @@ -385,6 +542,7 @@ class Operation(msrest.serialization.Model): 'display': {'key': 'display', 'type': 'OperationInfo'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'object'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, } def __init__( @@ -394,6 +552,7 @@ def __init__( display: Optional["OperationInfo"] = None, origin: Optional[str] = None, properties: Optional[object] = None, + is_data_action: Optional[bool] = None, **kwargs ): super(Operation, self).__init__(**kwargs) @@ -401,6 +560,7 @@ def __init__( self.display = display self.origin = origin self.properties = properties + self.is_data_action = is_data_action class OperationInfo(msrest.serialization.Model): @@ -460,11 +620,91 @@ def __init__( self.value = value +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.maintenance.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.maintenance.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type 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 + ): + 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 TaskProperties(msrest.serialization.Model): + """Task properties of the software update configuration. + + :param parameters: Gets or sets the parameters of the task. + :type parameters: dict[str, str] + :param source: Gets or sets the name of the runbook. + :type source: str + :param task_scope: Global Task execute once when schedule trigger. Resource task execute for + each VM. Possible values include: "Global", "Resource". Default value: "Global". + :type task_scope: str or ~azure.mgmt.maintenance.models.TaskScope + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': '{str}'}, + 'source': {'key': 'source', 'type': 'str'}, + 'task_scope': {'key': 'taskScope', 'type': 'str'}, + } + + def __init__( + self, + *, + parameters: Optional[Dict[str, str]] = None, + source: Optional[str] = None, + task_scope: Optional[Union[str, "TaskScope"]] = "Global", + **kwargs + ): + super(TaskProperties, self).__init__(**kwargs) + self.parameters = parameters + self.source = source + self.task_scope = task_scope + + class Update(msrest.serialization.Model): """Maintenance update on a resource. - :param maintenance_scope: The impact area. Possible values include: "All", "Host", "Resource", - "InResource", "OSImage", "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". + :param maintenance_scope: The impact area. Possible values include: "Host", "OSImage", + "Extension", "InGuestPatch", "SQLDB", "SQLManagedInstance". :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope :param impact_type: The impact type. Possible values include: "None", "Freeze", "Restart", "Redeploy". diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/__init__.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/__init__.py index 4c08356e4478..9073f0a77635 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/__init__.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/__init__.py @@ -10,6 +10,9 @@ from ._apply_updates_operations import ApplyUpdatesOperations from ._configuration_assignments_operations import ConfigurationAssignmentsOperations from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._maintenance_configurations_for_resource_group_operations import MaintenanceConfigurationsForResourceGroupOperations +from ._apply_update_for_resource_group_operations import ApplyUpdateForResourceGroupOperations +from ._configuration_assignments_within_subscription_operations import ConfigurationAssignmentsWithinSubscriptionOperations from ._operations import Operations from ._updates_operations import UpdatesOperations @@ -18,6 +21,9 @@ 'ApplyUpdatesOperations', 'ConfigurationAssignmentsOperations', 'MaintenanceConfigurationsOperations', + 'MaintenanceConfigurationsForResourceGroupOperations', + 'ApplyUpdateForResourceGroupOperations', + 'ConfigurationAssignmentsWithinSubscriptionOperations', 'Operations', 'UpdatesOperations', ] diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_update_for_resource_group_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_update_for_resource_group_operations.py new file mode 100644 index 000000000000..c262ae673c69 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_update_for_resource_group_operations.py @@ -0,0 +1,120 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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]] + +class ApplyUpdateForResourceGroupOperations(object): + """ApplyUpdateForResourceGroupOperations 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.maintenance.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 + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListApplyUpdate"] + """Get Configuration records within a subscription and resource group. + + Get Configuration records within a subscription and resource group. + + :param resource_group_name: 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 ListApplyUpdate or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.maintenance.models.ListApplyUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplyUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListApplyUpdate', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.Maintenance/applyUpdates'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_updates_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_updates_operations.py index a398ccd349c7..1d7a8caea5ab 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_updates_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_updates_operations.py @@ -9,6 +9,7 @@ import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -17,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +85,7 @@ def get_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -115,7 +116,8 @@ def get_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -159,7 +161,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -188,7 +190,8 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -235,7 +238,7 @@ def create_or_update_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -265,7 +268,8 @@ def create_or_update_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -306,7 +310,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -334,7 +338,8 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplyUpdate', pipeline_response) @@ -343,3 +348,73 @@ def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListApplyUpdate"] + """Get Configuration records within a subscription. + + Get Configuration records within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListApplyUpdate or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.maintenance.models.ListApplyUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplyUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListApplyUpdate', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_operations.py index 7c1af076ce64..79e520bb9765 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_operations.py @@ -45,6 +45,88 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def get_parent( + self, + resource_group_name, # type: str + provider_name, # type: str + resource_parent_type, # type: str + resource_parent_name, # type: str + resource_type, # type: str + resource_name, # type: str + configuration_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationAssignment" + """Get configuration assignment. + + Get configuration for resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provider_name: Resource provider name. + :type provider_name: str + :param resource_parent_type: Resource parent type. + :type resource_parent_type: str + :param resource_parent_name: Resource parent identifier. + :type resource_parent_name: str + :param resource_type: Resource type. + :type resource_type: str + :param resource_name: Resource identifier. + :type resource_name: str + :param configuration_assignment_name: Configuration assignment name. + :type configuration_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_parent.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceParentType': self._serialize.url("resource_parent_type", resource_parent_type, 'str'), + 'resourceParentName': self._serialize.url("resource_parent_name", resource_parent_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'configurationAssignmentName': self._serialize.url("configuration_assignment_name", configuration_assignment_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) + 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.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + def create_or_update_parent( self, resource_group_name, # type: str @@ -88,7 +170,7 @@ def create_or_update_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -124,7 +206,8 @@ def create_or_update_parent( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -145,7 +228,7 @@ def delete_parent( configuration_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.ConfigurationAssignment" + # type: (...) -> Optional["_models.ConfigurationAssignment"] """Unregister configuration for resource. Unregister configuration for resource. @@ -166,15 +249,15 @@ def delete_parent( :type configuration_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationAssignment, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -203,9 +286,86 @@ def delete_parent( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + provider_name, # type: str + resource_type, # type: str + resource_name, # type: str + configuration_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationAssignment" + """Get configuration assignment. + + Get configuration for resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provider_name: Resource provider name. + :type provider_name: str + :param resource_type: Resource type. + :type resource_type: str + :param resource_name: Resource identifier. + :type resource_name: str + :param configuration_assignment_name: Configuration assignment name. + :type configuration_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'configurationAssignmentName': self._serialize.url("configuration_assignment_name", configuration_assignment_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) + 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -213,7 +373,7 @@ def delete_parent( return cls(pipeline_response, deserialized, {}) return deserialized - delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} # type: ignore def create_or_update( self, @@ -252,7 +412,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -286,7 +446,8 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) @@ -305,7 +466,7 @@ def delete( configuration_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.ConfigurationAssignment" + # type: (...) -> Optional["_models.ConfigurationAssignment"] """Unregister configuration for resource. Unregister configuration for resource. @@ -322,15 +483,15 @@ def delete( :type configuration_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationAssignment, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -357,11 +518,14 @@ def delete( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -406,7 +570,7 @@ def list_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -452,8 +616,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -493,7 +658,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -537,8 +702,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_within_subscription_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_within_subscription_operations.py new file mode 100644 index 000000000000..fef66c507d50 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_within_subscription_operations.py @@ -0,0 +1,116 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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]] + +class ConfigurationAssignmentsWithinSubscriptionOperations(object): + """ConfigurationAssignmentsWithinSubscriptionOperations 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.maintenance.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 + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListConfigurationAssignmentsResult"] + """Get configuration assignment within a subscription. + + Get configuration assignment within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListConfigurationAssignmentsResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.maintenance.models.ListConfigurationAssignmentsResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListConfigurationAssignmentsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListConfigurationAssignmentsResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_for_resource_group_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_for_resource_group_operations.py new file mode 100644 index 000000000000..37edd5bd4fc5 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_for_resource_group_operations.py @@ -0,0 +1,120 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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]] + +class MaintenanceConfigurationsForResourceGroupOperations(object): + """MaintenanceConfigurationsForResourceGroupOperations 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.maintenance.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 + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListMaintenanceConfigurationsResult"] + """Get Configuration records within a subscription and resource group. + + Get Configuration records within a subscription and resource group. + + :param resource_group_name: 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 ListMaintenanceConfigurationsResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.maintenance.models.ListMaintenanceConfigurationsResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListMaintenanceConfigurationsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListMaintenanceConfigurationsResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.Maintenance/maintenanceConfigurations'} # type: ignore diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_operations.py index e17ad7054daa..a7277d8f85b1 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_operations.py @@ -70,7 +70,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -96,7 +96,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -135,7 +135,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -166,7 +166,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -183,7 +183,7 @@ def delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.MaintenanceConfiguration" + # type: (...) -> Optional["_models.MaintenanceConfiguration"] """Delete Configuration record. Delete Configuration record. @@ -194,15 +194,15 @@ def delete( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MaintenanceConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.maintenance.models.MaintenanceConfiguration + :rtype: ~azure.mgmt.maintenance.models.MaintenanceConfiguration or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MaintenanceConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -226,12 +226,14 @@ def delete( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -267,7 +269,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -298,7 +300,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) @@ -328,7 +330,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -368,7 +370,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_operations.py index 2968f658bced..e3457e9b2810 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_operations.py @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -100,7 +100,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_operations.py index 80dbe5c4881a..17d160bcbffb 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_operations.py @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -104,7 +104,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -137,7 +137,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -162,7 +162,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.MaintenanceError, response) + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_updates_operations.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_updates_operations.py index 9ed5454b107c..82df162b8c92 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_updates_operations.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_updates_operations.py @@ -82,7 +82,7 @@ def list_parent( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -128,8 +128,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -169,7 +170,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -213,8 +214,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response