From 0052ae99b5a7796e53bb088c88357a4774beb18d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 7 May 2021 03:06:44 +0000 Subject: [PATCH] CodeGen from PR 14299 in Azure/azure-rest-api-specs Merge 225e4a77704766b9b6529c40c2677b22b58da9b9 into 3f1e770aa89c7d306d7cdb4f7aa852819d2f9fa8 --- .../azure-mgmt-maintenance/MANIFEST.in | 1 + .../azure-mgmt-maintenance/_meta.json | 8 + .../_maintenance_management_client.py | 17 +- .../azure/mgmt/maintenance/models/__init__.py | 11 +- .../_maintenance_management_client_enums.py | 42 +++-- .../azure/mgmt/maintenance/models/_models.py | 124 +++++++++++++- .../mgmt/maintenance/models/_models_py3.py | 128 +++++++++++++- .../mgmt/maintenance/models/_paged_models.py | 29 +++- .../mgmt/maintenance/operations/__init__.py | 6 + ...ly_update_for_resource_group_operations.py | 107 ++++++++++++ .../operations/_apply_updates_operations.py | 98 ++++++++--- .../_configuration_assignments_operations.py | 51 +++--- ...gurations_for_resource_group_operations.py | 107 ++++++++++++ .../_maintenance_configurations_operations.py | 14 +- .../maintenance/operations/_operations.py | 4 +- ...c_maintenance_configurations_operations.py | 161 ++++++++++++++++++ .../operations/_updates_operations.py | 19 +-- 17 files changed, 826 insertions(+), 101 deletions(-) create mode 100644 sdk/maintenance/azure-mgmt-maintenance/_meta.json 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/_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..639ae9e04d13 --- /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": "d613f610b7b335411c6212d644c9022992252572", + "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/_maintenance_management_client.py b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py index feb0c58cf1af..0d5b4be48aac 100644 --- a/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py +++ b/sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py @@ -13,9 +13,12 @@ from msrest import Serializer, Deserializer from ._configuration import MaintenanceManagementClientConfiguration +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 Operations from .operations import UpdatesOperations from . import models @@ -27,12 +30,18 @@ class MaintenanceManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: MaintenanceManagementClientConfiguration + :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 operations: Operations operations :vartype operations: azure.mgmt.maintenance.operations.Operations :ivar updates: Updates operations @@ -55,16 +64,22 @@ def __init__( super(MaintenanceManagementClient, 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-05-01' 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.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..070f05759aff 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 @@ -18,6 +18,7 @@ from ._models_py3 import Operation from ._models_py3 import OperationInfo from ._models_py3 import Resource + from ._models_py3 import SystemData from ._models_py3 import Update except (SyntaxError, ImportError): from ._models import ApplyUpdate @@ -28,14 +29,18 @@ from ._models import Operation from ._models import OperationInfo from ._models import Resource + from ._models import SystemData 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 ( UpdateStatus, + CreatedByType, MaintenanceScope, + Visibility, ImpactType, ) @@ -48,12 +53,16 @@ 'Operation', 'OperationInfo', 'Resource', + 'SystemData', 'Update', - 'ConfigurationAssignmentPaged', 'MaintenanceConfigurationPaged', + 'ApplyUpdatePaged', + 'ConfigurationAssignmentPaged', 'OperationPaged', 'UpdatePaged', 'UpdateStatus', + 'CreatedByType', 'MaintenanceScope', + 'Visibility', '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_management_client_enums.py index 83ce8e7ded5f..78ea5628a5d9 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_management_client_enums.py @@ -14,24 +14,40 @@ class UpdateStatus(str, Enum): - pending = "Pending" - in_progress = "InProgress" - completed = "Completed" - retry_now = "RetryNow" - retry_later = "RetryLater" + pending = "Pending" #: There are pending updates to be installed. + in_progress = "InProgress" #: Updates installation are in progress. + completed = "Completed" #: All updates are successfully applied. + retry_now = "RetryNow" #: Updates installation failed but are ready to retry again. + retry_later = "RetryLater" #: Updates installation failed and should be retried later. + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" class MaintenanceScope(str, Enum): - all = "All" - host = "Host" - resource = "Resource" - in_resource = "InResource" + host = "Host" #: This maintenance scope controls installation of azure platform updates i.e. services on physical nodes hosting customer VMs. + os_image = "OSImage" #: This maintenance scope controls os image installation on VM/VMSS + extension = "Extension" #: This maintenance scope controls extension installation on VM/VMSS + in_guest_patch = "InGuestPatch" #: This maintenance scope controls installation of windows and linux packages on VM/VMSS + sqldb = "SQLDB" #: This maintenance scope controls installation of SQL server platform updates. + sql_managed_instance = "SQLManagedInstance" #: This maintenance scope controls installation of SQL managed instance platform update. + + +class Visibility(str, Enum): + + custom = "Custom" #: Only visible to users with permissions. + public = "Public" #: Visible to all users. class ImpactType(str, Enum): - none = "None" - freeze = "Freeze" - restart = "Restart" - redeploy = "Redeploy" + none = "None" #: Pending updates has no impact on resource. + freeze = "Freeze" #: Pending updates can freeze network or disk io operation on resource. + restart = "Restart" #: Pending updates can cause resource to restart. + redeploy = "Redeploy" #: Pending updates can redeploy resource. 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..f82ed72689a9 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'}, @@ -172,6 +188,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 +201,73 @@ 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. The + default value is 'Custom'. Possible values include: 'Custom', 'Public' + :type visibility: str or ~azure.mgmt.maintenance.models.Visibility """ _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'}, } def __init__(self, **kwargs): @@ -212,6 +277,12 @@ 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) class MaintenanceError(Model): @@ -253,6 +324,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 +333,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 +342,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 +373,52 @@ 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 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..6e1c5a15a2ae 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'}, @@ -172,6 +188,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 +201,88 @@ 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. The + default value is 'Custom'. Possible values include: 'Custom', 'Public' + :type visibility: str or ~azure.mgmt.maintenance.models.Visibility """ _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'}, } - 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, **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 class MaintenanceError(Model): @@ -253,6 +324,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 +333,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 +373,52 @@ 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 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..919cbf17c302 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,22 @@ # 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 ._operations import Operations from ._updates_operations import UpdatesOperations __all__ = [ + 'PublicMaintenanceConfigurationsOperations', 'ApplyUpdatesOperations', 'ConfigurationAssignmentsOperations', 'MaintenanceConfigurationsOperations', + 'MaintenanceConfigurationsForResourceGroupOperations', + 'ApplyUpdateForResourceGroupOperations', '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..d74ac60ad29e --- /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-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-05-01" + + 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..ad74cbd9c505 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-05-01". """ 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-05-01" 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..fb86806a854e 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-05-01". """ 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-05-01" self.config = config @@ -70,7 +69,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 +109,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 +151,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 +186,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: @@ -230,7 +227,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 +265,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 +303,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 +336,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 +376,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 +422,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 +457,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 +501,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/_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..143bca030f1d --- /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-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-05-01" + + 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..a1ccf1c7ce33 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-05-01". """ 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-05-01" self.config = config @@ -44,7 +44,7 @@ def get( :param resource_group_name: Resource Group Name :type resource_group_name: str - :param resource_name: Resource Identifier + :param resource_name: Maintenance Configuration Name :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 @@ -104,7 +104,7 @@ def create_or_update( :param resource_group_name: Resource Group Name :type resource_group_name: str - :param resource_name: Resource Identifier + :param resource_name: Maintenance Configuration Name :type resource_name: str :param configuration: The configuration :type configuration: @@ -171,7 +171,7 @@ def delete( :param resource_group_name: Resource Group Name :type resource_group_name: str - :param resource_name: Resource Identifier + :param resource_name: Maintenance Configuration Name :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 @@ -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 @@ -231,7 +231,7 @@ def update_method( :param resource_group_name: Resource Group Name :type resource_group_name: str - :param resource_name: Resource Identifier + :param resource_name: Maintenance Configuration Name :type resource_name: str :param configuration: The configuration :type configuration: 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..461894ab6de8 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-05-01". """ 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-05-01" 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..ff6f94db7bbd --- /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-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-05-01" + + 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: Maintenance Configuration Name + :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..7bcab6f89ff0 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-05-01". """ 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-05-01" 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