From 9b06f2f27f23b123243a93500aa11c4226b6fe59 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 20 Apr 2021 06:23:10 +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/__init__.py | 6 +- .../azure/mgmt/maintenance/_configuration.py | 6 +- ...ement_client.py => _maintenance_client.py} | 34 ++- .../azure/mgmt/maintenance/models/__init__.py | 29 +- ..._enums.py => _maintenance_client_enums.py} | 33 ++- .../azure/mgmt/maintenance/models/_models.py | 249 ++++++++++++++++- .../mgmt/maintenance/models/_models_py3.py | 253 +++++++++++++++++- .../mgmt/maintenance/models/_paged_models.py | 29 +- .../mgmt/maintenance/operations/__init__.py | 8 + ...ly_update_for_resource_group_operations.py | 107 ++++++++ .../operations/_apply_updates_operations.py | 98 +++++-- .../_configuration_assignments_operations.py | 199 ++++++++++++-- ...ignments_within_subscription_operations.py | 104 +++++++ ...gurations_for_resource_group_operations.py | 107 ++++++++ .../_maintenance_configurations_operations.py | 6 +- .../maintenance/operations/_operations.py | 4 +- ...c_maintenance_configurations_operations.py | 161 +++++++++++ .../operations/_updates_operations.py | 19 +- 20 files changed, 1362 insertions(+), 99 deletions(-) create mode 100644 sdk/maintenance/azure-mgmt-maintenance/_meta.json rename sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/{_maintenance_management_client.py => _maintenance_client.py} (56%) rename sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/{_maintenance_management_client_enums.py => _maintenance_client_enums.py} (60%) 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 create mode 100644 sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_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..52b204dab93d --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "eb6d68be864349a8fd33d261e90bb2756e904e82", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maintenance/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/maintenance/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/__init__.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/__init__.py index e408966c8075..973aea27439f 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/__init__.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/__init__.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import MaintenanceManagementClientConfiguration -from ._maintenance_management_client import MaintenanceManagementClient -__all__ = ['MaintenanceManagementClient', 'MaintenanceManagementClientConfiguration'] +from ._configuration import MaintenanceClientConfiguration +from ._maintenance_client import MaintenanceClient +__all__ = ['MaintenanceClient', 'MaintenanceClientConfiguration'] from .version import VERSION 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 c5f9c068a7de..7a07d5c6541c 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py @@ -13,8 +13,8 @@ from .version import VERSION -class MaintenanceManagementClientConfiguration(AzureConfiguration): - """Configuration for MaintenanceManagementClient +class MaintenanceClientConfiguration(AzureConfiguration): + """Configuration for MaintenanceClient Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( if not base_url: base_url = 'https://management.azure.com' - super(MaintenanceManagementClientConfiguration, self).__init__(base_url) + super(MaintenanceClientConfiguration, self).__init__(base_url) # Starting Autorest.Python 4.0.64, make connection pool activated by default self.keep_alive = True diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py similarity index 56% rename from sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py rename to sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py index feb0c58cf1af..ba3d933d0838 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_client.py @@ -12,27 +12,39 @@ from msrest.service_client import SDKClient from msrest import Serializer, Deserializer -from ._configuration import MaintenanceManagementClientConfiguration +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 -class MaintenanceManagementClient(SDKClient): - """Azure Maintenance Management Client +class MaintenanceClient(SDKClient): + """Maintenance Client :ivar config: Configuration for client. - :vartype config: MaintenanceManagementClientConfiguration + :vartype config: MaintenanceClientConfiguration + :ivar public_maintenance_configurations: PublicMaintenanceConfigurations operations + :vartype public_maintenance_configurations: azure.mgmt.maintenance.operations.PublicMaintenanceConfigurationsOperations :ivar apply_updates: ApplyUpdates operations :vartype apply_updates: azure.mgmt.maintenance.operations.ApplyUpdatesOperations :ivar configuration_assignments: ConfigurationAssignments operations :vartype configuration_assignments: azure.mgmt.maintenance.operations.ConfigurationAssignmentsOperations :ivar maintenance_configurations: MaintenanceConfigurations operations :vartype maintenance_configurations: azure.mgmt.maintenance.operations.MaintenanceConfigurationsOperations + :ivar maintenance_configurations_for_resource_group: MaintenanceConfigurationsForResourceGroup operations + :vartype maintenance_configurations_for_resource_group: azure.mgmt.maintenance.operations.MaintenanceConfigurationsForResourceGroupOperations + :ivar apply_update_for_resource_group: ApplyUpdateForResourceGroup operations + :vartype apply_update_for_resource_group: azure.mgmt.maintenance.operations.ApplyUpdateForResourceGroupOperations + :ivar configuration_assignments_within_subscription: ConfigurationAssignmentsWithinSubscription operations + :vartype configuration_assignments_within_subscription: azure.mgmt.maintenance.operations.ConfigurationAssignmentsWithinSubscriptionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.maintenance.operations.Operations :ivar updates: Updates operations @@ -51,20 +63,28 @@ class MaintenanceManagementClient(SDKClient): def __init__( self, credentials, subscription_id, base_url=None): - self.config = MaintenanceManagementClientConfiguration(credentials, subscription_id, base_url) - super(MaintenanceManagementClient, self).__init__(self.config.credentials, self.config) + self.config = MaintenanceClientConfiguration(credentials, subscription_id, base_url) + super(MaintenanceClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-06-01-preview' + self.api_version = '2021-04-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.public_maintenance_configurations = PublicMaintenanceConfigurationsOperations( + self._client, self.config, self._serialize, self._deserialize) self.apply_updates = ApplyUpdatesOperations( self._client, self.config, self._serialize, self._deserialize) self.configuration_assignments = ConfigurationAssignmentsOperations( 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( 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 ff81da3b1a0c..0d4b67f09a5f 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 @@ -13,29 +13,44 @@ 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 MaintenanceConfiguration from ._models_py3 import MaintenanceError, MaintenanceErrorException from ._models_py3 import Operation from ._models_py3 import OperationInfo 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 from ._models import ConfigurationAssignment from ._models import ErrorDetails + from ._models import InputLinuxParameters + from ._models import InputPatchConfiguration + from ._models import InputWindowsParameters from ._models import MaintenanceConfiguration from ._models import MaintenanceError, MaintenanceErrorException from ._models import Operation from ._models import OperationInfo from ._models import Resource + from ._models import SystemData + from ._models import TaskProperties from ._models import Update +from ._paged_models import ApplyUpdatePaged from ._paged_models import ConfigurationAssignmentPaged from ._paged_models import MaintenanceConfigurationPaged from ._paged_models import OperationPaged from ._paged_models import UpdatePaged -from ._maintenance_management_client_enums import ( +from ._maintenance_client_enums import ( UpdateStatus, + CreatedByType, MaintenanceScope, + Visibility, + RebootOptions, + TaskScope, ImpactType, ) @@ -43,17 +58,27 @@ 'ApplyUpdate', 'ConfigurationAssignment', 'ErrorDetails', + 'InputLinuxParameters', + 'InputPatchConfiguration', + 'InputWindowsParameters', 'MaintenanceConfiguration', 'MaintenanceError', 'MaintenanceErrorException', 'Operation', 'OperationInfo', 'Resource', + 'SystemData', + 'TaskProperties', 'Update', - 'ConfigurationAssignmentPaged', 'MaintenanceConfigurationPaged', + 'ApplyUpdatePaged', + 'ConfigurationAssignmentPaged', 'OperationPaged', 'UpdatePaged', 'UpdateStatus', + 'CreatedByType', 'MaintenanceScope', + 'Visibility', + 'RebootOptions', + 'TaskScope', 'ImpactType', ] diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_management_client_enums.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py similarity index 60% rename from sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_management_client_enums.py rename to sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py index 83ce8e7ded5f..7cb25117993d 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_management_client_enums.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_maintenance_client_enums.py @@ -21,12 +21,41 @@ class UpdateStatus(str, Enum): retry_later = "RetryLater" +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" + + class MaintenanceScope(str, Enum): - all = "All" host = "Host" + os_image = "OSImage" + extension = "Extension" + in_guest_patch = "InGuestPatch" + sqldb = "SQLDB" + sql_managed_instance = "SQLManagedInstance" + + +class Visibility(str, Enum): + + custom = "Custom" + public = "Public" + + +class RebootOptions(str, Enum): + + never_reboot = "NeverReboot" + reboot_if_required = "RebootIfRequired" + always_reboot = "AlwaysReboot" + + +class TaskScope(str, Enum): + + global_enum = "Global" resource = "Resource" - in_resource = "InResource" class ImpactType(str, Enum): 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 0dba7759bcf7..9b8d541b44e6 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 @@ -25,18 +25,23 @@ class Resource(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__(self, **kwargs): @@ -44,6 +49,7 @@ def __init__(self, **kwargs): self.id = None self.name = None self.type = None + self.system_data = None class ApplyUpdate(Resource): @@ -58,6 +64,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 @@ -71,12 +80,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'}, @@ -109,6 +120,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 @@ -121,12 +135,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'}, @@ -160,6 +176,99 @@ def __init__(self, **kwargs): self.message = kwargs.get('message', None) +class InputLinuxParameters(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(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(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 MaintenanceConfiguration(Resource): """Maintenance configuration record type. @@ -172,6 +281,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: Gets or sets tags of the resource @@ -182,27 +294,78 @@ class MaintenanceConfiguration(Resource): maintenanceConfiguration :type extension_properties: dict[str, str] :param maintenance_scope: Gets or sets maintenanceScope of the - configuration. Possible values include: 'All', 'Host', 'Resource', - 'InResource' + configuration. Possible values include: 'Host', 'OSImage', 'Extension', + 'InGuestPatch', 'SQLDB', 'SQLManagedInstance' :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope + :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. + :type start_date_time: str + :param expiration_date_time: Effective expiration date of the maintenance + window in YYYY-MM-DD hh:mm format. The window will be created in the time + zone provided and adjusted to daylight savings according to that time + zone. Expiration date must be set to a future date. If not provided, it + will be set to the maximum datetime 9999-12-31 23:59:59. + :type expiration_date_time: str + :param duration: Duration of the maintenance window in HH:mm format. If + not provided, default value will be used based on maintenance scope + provided. Example: 05:00. + :type duration: str + :param time_zone: Name of the timezone. List of timezones can be obtained + by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea + Standard Time, Cen. Australia Standard Time. + :type time_zone: str + :param recur_every: Rate at which a Maintenance window is expected to + recur. The rate can be expressed as daily, weekly, or monthly schedules. + Daily schedule are formatted as recurEvery: [Frequency as + integer]['Day(s)']. If no frequency is provided, the default frequency is + 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly + schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] + [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule + examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly + schedules are formatted as [Frequency as integer]['Month(s)'] [Comma + separated list of month days] or [Frequency as integer]['Month(s)'] [Week + of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. + Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, + recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: + Month Fourth Monday. + :type recur_every: str + :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 """ _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'}, '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'}, + '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'}, + 'time_zone': {'key': 'properties.maintenanceWindow.timeZone', 'type': 'str'}, + 'recur_every': {'key': 'properties.maintenanceWindow.recurEvery', 'type': 'str'}, + 'visibility': {'key': 'properties.visibility', 'type': 'str'}, + 'install_patches': {'key': 'properties.installPatches', 'type': 'InputPatchConfiguration'}, } def __init__(self, **kwargs): @@ -212,6 +375,13 @@ def __init__(self, **kwargs): self.namespace = kwargs.get('namespace', None) self.extension_properties = kwargs.get('extension_properties', None) self.maintenance_scope = kwargs.get('maintenance_scope', 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) + self.time_zone = kwargs.get('time_zone', None) + self.recur_every = kwargs.get('recur_every', None) + self.visibility = kwargs.get('visibility', None) + self.install_patches = kwargs.get('install_patches', None) class MaintenanceError(Model): @@ -253,6 +423,8 @@ class Operation(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 = { @@ -260,6 +432,7 @@ class Operation(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__(self, **kwargs): @@ -268,6 +441,7 @@ def __init__(self, **kwargs): 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(Model): @@ -298,11 +472,78 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class SystemData(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 + :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 + """ + + _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(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(Model): """Maintenance update on a resource. - :param maintenance_scope: The impact area. Possible values include: 'All', - 'Host', 'Resource', 'InResource' + :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', 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 a87624b67e6f..bfed814802e1 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 @@ -25,18 +25,23 @@ class Resource(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__(self, **kwargs) -> None: @@ -44,6 +49,7 @@ def __init__(self, **kwargs) -> None: self.id = None self.name = None self.type = None + self.system_data = None class ApplyUpdate(Resource): @@ -58,6 +64,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 @@ -71,12 +80,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'}, @@ -109,6 +120,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 @@ -121,12 +135,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'}, @@ -160,6 +176,99 @@ def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: self.message = message +class InputLinuxParameters(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=None, package_name_masks_to_include=None, classifications_to_include=None, **kwargs) -> None: + 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(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=None, windows_parameters=None, linux_parameters=None, pre_tasks=None, post_tasks=None, **kwargs) -> None: + 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(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=None, kb_numbers_to_include=None, classifications_to_include=None, **kwargs) -> None: + 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 MaintenanceConfiguration(Resource): """Maintenance configuration record type. @@ -172,6 +281,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: Gets or sets tags of the resource @@ -182,36 +294,94 @@ class MaintenanceConfiguration(Resource): maintenanceConfiguration :type extension_properties: dict[str, str] :param maintenance_scope: Gets or sets maintenanceScope of the - configuration. Possible values include: 'All', 'Host', 'Resource', - 'InResource' + configuration. Possible values include: 'Host', 'OSImage', 'Extension', + 'InGuestPatch', 'SQLDB', 'SQLManagedInstance' :type maintenance_scope: str or ~azure.mgmt.maintenance.models.MaintenanceScope + :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. + :type start_date_time: str + :param expiration_date_time: Effective expiration date of the maintenance + window in YYYY-MM-DD hh:mm format. The window will be created in the time + zone provided and adjusted to daylight savings according to that time + zone. Expiration date must be set to a future date. If not provided, it + will be set to the maximum datetime 9999-12-31 23:59:59. + :type expiration_date_time: str + :param duration: Duration of the maintenance window in HH:mm format. If + not provided, default value will be used based on maintenance scope + provided. Example: 05:00. + :type duration: str + :param time_zone: Name of the timezone. List of timezones can be obtained + by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea + Standard Time, Cen. Australia Standard Time. + :type time_zone: str + :param recur_every: Rate at which a Maintenance window is expected to + recur. The rate can be expressed as daily, weekly, or monthly schedules. + Daily schedule are formatted as recurEvery: [Frequency as + integer]['Day(s)']. If no frequency is provided, the default frequency is + 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly + schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] + [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule + examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly + schedules are formatted as [Frequency as integer]['Month(s)'] [Comma + separated list of month days] or [Frequency as integer]['Month(s)'] [Week + of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. + Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, + recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: + Month Fourth Monday. + :type recur_every: str + :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 """ _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'}, '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'}, + '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'}, + 'time_zone': {'key': 'properties.maintenanceWindow.timeZone', 'type': 'str'}, + 'recur_every': {'key': 'properties.maintenanceWindow.recurEvery', 'type': 'str'}, + 'visibility': {'key': 'properties.visibility', 'type': 'str'}, + 'install_patches': {'key': 'properties.installPatches', 'type': 'InputPatchConfiguration'}, } - def __init__(self, *, location: str=None, tags=None, namespace: str=None, extension_properties=None, maintenance_scope=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, namespace: str=None, extension_properties=None, maintenance_scope=None, start_date_time: str=None, expiration_date_time: str=None, duration: str=None, time_zone: str=None, recur_every: str=None, visibility=None, install_patches=None, **kwargs) -> None: super(MaintenanceConfiguration, self).__init__(**kwargs) self.location = location self.tags = tags self.namespace = namespace self.extension_properties = extension_properties self.maintenance_scope = maintenance_scope + self.start_date_time = start_date_time + self.expiration_date_time = expiration_date_time + self.duration = duration + self.time_zone = time_zone + self.recur_every = recur_every + self.visibility = visibility + self.install_patches = install_patches class MaintenanceError(Model): @@ -253,6 +423,8 @@ class Operation(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 = { @@ -260,14 +432,16 @@ class Operation(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__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, is_data_action: bool=None, **kwargs) -> None: super(Operation, self).__init__(**kwargs) self.name = name self.display = display self.origin = origin self.properties = properties + self.is_data_action = is_data_action class OperationInfo(Model): @@ -298,11 +472,78 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description +class SystemData(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 + :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 + """ + + _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: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + 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(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=None, source: str=None, task_scope="Global", **kwargs) -> None: + super(TaskProperties, self).__init__(**kwargs) + self.parameters = parameters + self.source = source + self.task_scope = task_scope + + class Update(Model): """Maintenance update on a resource. - :param maintenance_scope: The impact area. Possible values include: 'All', - 'Host', 'Resource', 'InResource' + :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', diff --git a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_paged_models.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_paged_models.py index 45d6a08e3c6d..d7599349ef9f 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_paged_models.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/models/_paged_models.py @@ -12,32 +12,45 @@ from msrest.paging import Paged -class ConfigurationAssignmentPaged(Paged): +class MaintenanceConfigurationPaged(Paged): """ - A paging container for iterating over a list of :class:`ConfigurationAssignment ` object + A paging container for iterating over a list of :class:`MaintenanceConfiguration ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ConfigurationAssignment]'} + 'current_page': {'key': 'value', 'type': '[MaintenanceConfiguration]'} } def __init__(self, *args, **kwargs): - super(ConfigurationAssignmentPaged, self).__init__(*args, **kwargs) -class MaintenanceConfigurationPaged(Paged): + super(MaintenanceConfigurationPaged, self).__init__(*args, **kwargs) +class ApplyUpdatePaged(Paged): """ - A paging container for iterating over a list of :class:`MaintenanceConfiguration ` object + A paging container for iterating over a list of :class:`ApplyUpdate ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[MaintenanceConfiguration]'} + 'current_page': {'key': 'value', 'type': '[ApplyUpdate]'} } def __init__(self, *args, **kwargs): - super(MaintenanceConfigurationPaged, self).__init__(*args, **kwargs) + super(ApplyUpdatePaged, self).__init__(*args, **kwargs) +class ConfigurationAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`ConfigurationAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ConfigurationAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(ConfigurationAssignmentPaged, self).__init__(*args, **kwargs) class OperationPaged(Paged): """ A paging container for iterating over a list of :class:`Operation ` object 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 85b97ca76a15..5684c3f4d749 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 @@ -9,16 +9,24 @@ # regenerated. # -------------------------------------------------------------------------- +from ._public_maintenance_configurations_operations import PublicMaintenanceConfigurationsOperations 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 __all__ = [ + 'PublicMaintenanceConfigurationsOperations', '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..a4b1fb40d59f --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_apply_update_for_resource_group_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ApplyUpdateForResourceGroupOperations(object): + """ApplyUpdateForResourceGroupOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-04-01-preview" + + self.config = config + + def list( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get Configuration records within a subscription and resource group. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ApplyUpdate + :rtype: + ~azure.mgmt.maintenance.models.ApplyUpdatePaged[~azure.mgmt.maintenance.models.ApplyUpdate] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ApplyUpdatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates'} 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 272cc2b447f8..37f7d096571a 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,7 +24,7 @@ class ApplyUpdatesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2018-06-01-preview". + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". """ models = models @@ -35,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2021-04-01-preview" self.config = config @@ -67,7 +66,8 @@ def get_parent( :return: ApplyUpdate or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.get_parent.metadata['url'] @@ -102,9 +102,7 @@ def get_parent( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -141,7 +139,8 @@ def get( :return: ApplyUpdate or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.get.metadata['url'] @@ -174,9 +173,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -215,7 +212,8 @@ def create_or_update_parent( :return: ApplyUpdate or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.create_or_update_parent.metadata['url'] @@ -249,9 +247,7 @@ def create_or_update_parent( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -286,7 +282,8 @@ def create_or_update( :return: ApplyUpdate or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.create_or_update.metadata['url'] @@ -318,9 +315,7 @@ def create_or_update( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -332,3 +327,68 @@ def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get Configuration records within a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ApplyUpdate + :rtype: + ~azure.mgmt.maintenance.models.ApplyUpdatePaged[~azure.mgmt.maintenance.models.ApplyUpdate] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ApplyUpdatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates'} 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 489a8991644a..9ee740020be2 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,7 +24,7 @@ class ConfigurationAssignmentsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2018-06-01-preview". + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". """ models = models @@ -35,10 +34,87 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2021-04-01-preview" self.config = config + def get_parent( + self, resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConfigurationAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`MaintenanceErrorException` + """ + # Construct URL + url = self.get_parent.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + def create_or_update_parent( self, resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers=None, raw=False, **operation_config): """Create configuration assignment. @@ -70,7 +146,8 @@ def create_or_update_parent( :return: ConfigurationAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.create_or_update_parent.metadata['url'] @@ -109,9 +186,7 @@ def create_or_update_parent( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -153,7 +228,8 @@ def delete_parent( :return: ConfigurationAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.delete_parent.metadata['url'] @@ -187,10 +263,8 @@ def delete_parent( request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 204]: + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -203,6 +277,77 @@ def delete_parent( return deserialized delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + def get( + self, resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConfigurationAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`MaintenanceErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + def create_or_update( self, resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers=None, raw=False, **operation_config): """Create configuration assignment. @@ -230,7 +375,8 @@ def create_or_update( :return: ConfigurationAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.create_or_update.metadata['url'] @@ -267,9 +413,7 @@ def create_or_update( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -307,7 +451,8 @@ def delete( :return: ConfigurationAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ # Construct URL url = self.delete.metadata['url'] @@ -339,10 +484,8 @@ def delete( request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 204]: + raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -381,7 +524,8 @@ def list_parent( :return: An iterator like instance of ConfigurationAssignment :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignmentPaged[~azure.mgmt.maintenance.models.ConfigurationAssignment] - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ def prepare_request(next_link=None): if not next_link: @@ -426,9 +570,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) return response @@ -463,7 +605,8 @@ def list( :return: An iterator like instance of ConfigurationAssignment :rtype: ~azure.mgmt.maintenance.models.ConfigurationAssignmentPaged[~azure.mgmt.maintenance.models.ConfigurationAssignment] - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ def prepare_request(next_link=None): if not next_link: @@ -506,9 +649,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) return 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..7f2f80aee366 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_configuration_assignments_within_subscription_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ConfigurationAssignmentsWithinSubscriptionOperations(object): + """ConfigurationAssignmentsWithinSubscriptionOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-04-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get configuration assignment within a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ConfigurationAssignment + :rtype: + ~azure.mgmt.maintenance.models.ConfigurationAssignmentPaged[~azure.mgmt.maintenance.models.ConfigurationAssignment] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConfigurationAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments'} 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..32042677612c --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_maintenance_configurations_for_resource_group_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MaintenanceConfigurationsForResourceGroupOperations(object): + """MaintenanceConfigurationsForResourceGroupOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-04-01-preview" + + self.config = config + + def list( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get Configuration records within a subscription and resource group. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MaintenanceConfiguration + :rtype: + ~azure.mgmt.maintenance.models.MaintenanceConfigurationPaged[~azure.mgmt.maintenance.models.MaintenanceConfiguration] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MaintenanceConfigurationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations'} 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 29b3618e634a..11e7e28d6240 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 @@ -24,7 +24,7 @@ class MaintenanceConfigurationsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2018-06-01-preview". + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2021-04-01-preview" self.config = config @@ -211,7 +211,7 @@ def delete( request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: raise models.MaintenanceErrorException(self._deserialize, response) deserialized = None 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 84c26550f29a..4c74a7d3f478 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 @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2018-06-01-preview". + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2021-04-01-preview" self.config = config 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 new file mode 100644 index 000000000000..d358f8169751 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/operations/_public_maintenance_configurations_operations.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class PublicMaintenanceConfigurationsOperations(object): + """PublicMaintenanceConfigurationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-04-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get Public Maintenance Configuration records. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MaintenanceConfiguration + :rtype: + ~azure.mgmt.maintenance.models.MaintenanceConfigurationPaged[~azure.mgmt.maintenance.models.MaintenanceConfiguration] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MaintenanceConfigurationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations'} + + def get( + self, resource_name, custom_headers=None, raw=False, **operation_config): + """Get Public Maintenance Configuration record. + + :param resource_name: Resource Identifier + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MaintenanceConfiguration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.MaintenanceConfiguration or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`MaintenanceErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.MaintenanceErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MaintenanceConfiguration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName}'} 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 e9a8eecb77c2..1840f73b898b 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,7 +24,7 @@ class UpdatesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2018-06-01-preview". + :ivar api_version: Version of the API to be used with the client request. Constant value: "2021-04-01-preview". """ models = models @@ -35,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2021-04-01-preview" self.config = config @@ -65,7 +64,8 @@ def list_parent( :return: An iterator like instance of Update :rtype: ~azure.mgmt.maintenance.models.UpdatePaged[~azure.mgmt.maintenance.models.Update] - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ def prepare_request(next_link=None): if not next_link: @@ -110,9 +110,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) return response @@ -147,7 +145,8 @@ def list( :return: An iterator like instance of Update :rtype: ~azure.mgmt.maintenance.models.UpdatePaged[~azure.mgmt.maintenance.models.Update] - :raises: :class:`CloudError` + :raises: + :class:`MaintenanceErrorException` """ def prepare_request(next_link=None): if not next_link: @@ -190,9 +189,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.MaintenanceErrorException(self._deserialize, response) return response