diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/__init__.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/__init__.py new file mode 100644 index 000000000000..e408966c8075 --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MaintenanceManagementClientConfiguration +from ._maintenance_management_client import MaintenanceManagementClient +__all__ = ['MaintenanceManagementClient', 'MaintenanceManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_configuration.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_configuration.py new file mode 100644 index 000000000000..fd7ddab8d9ad --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_configuration.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MaintenanceManagementClientConfiguration(AzureConfiguration): + """Configuration for MaintenanceManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials that uniquely identify a + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MaintenanceManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-Maintenance/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_maintenance_management_client.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_maintenance_management_client.py new file mode 100644 index 000000000000..feb0c58cf1af --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/_maintenance_management_client.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MaintenanceManagementClientConfiguration +from .operations import ApplyUpdatesOperations +from .operations import ConfigurationAssignmentsOperations +from .operations import MaintenanceConfigurationsOperations +from .operations import Operations +from .operations import UpdatesOperations +from . import models + + +class MaintenanceManagementClient(SDKClient): + """Azure Maintenance Management Client + + :ivar config: Configuration for client. + :vartype config: MaintenanceManagementClientConfiguration + + :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 operations: Operations operations + :vartype operations: azure.mgmt.maintenance.operations.Operations + :ivar updates: Updates operations + :vartype updates: azure.mgmt.maintenance.operations.UpdatesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials that uniquely identify a + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + 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) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + 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.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.updates = UpdatesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/__init__.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/__init__.py new file mode 100644 index 000000000000..ff81da3b1a0c --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/__init__.py @@ -0,0 +1,59 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ApplyUpdate + from ._models_py3 import ConfigurationAssignment + from ._models_py3 import ErrorDetails + 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 Update +except (SyntaxError, ImportError): + from ._models import ApplyUpdate + from ._models import ConfigurationAssignment + from ._models import ErrorDetails + from ._models import MaintenanceConfiguration + from ._models import MaintenanceError, MaintenanceErrorException + from ._models import Operation + from ._models import OperationInfo + from ._models import Resource + from ._models import Update +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, + MaintenanceScope, + ImpactType, +) + +__all__ = [ + 'ApplyUpdate', + 'ConfigurationAssignment', + 'ErrorDetails', + 'MaintenanceConfiguration', + 'MaintenanceError', 'MaintenanceErrorException', + 'Operation', + 'OperationInfo', + 'Resource', + 'Update', + 'ConfigurationAssignmentPaged', + 'MaintenanceConfigurationPaged', + 'OperationPaged', + 'UpdatePaged', + 'UpdateStatus', + 'MaintenanceScope', + 'ImpactType', +] diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_maintenance_management_client_enums.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_maintenance_management_client_enums.py new file mode 100644 index 000000000000..83ce8e7ded5f --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_maintenance_management_client_enums.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class UpdateStatus(str, Enum): + + pending = "Pending" + in_progress = "InProgress" + completed = "Completed" + retry_now = "RetryNow" + retry_later = "RetryLater" + + +class MaintenanceScope(str, Enum): + + all = "All" + host = "Host" + resource = "Resource" + in_resource = "InResource" + + +class ImpactType(str, Enum): + + none = "None" + freeze = "Freeze" + restart = "Restart" + redeploy = "Redeploy" diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models.py new file mode 100644 index 000000000000..0dba7759bcf7 --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models.py @@ -0,0 +1,339 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Definition of a Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ApplyUpdate(Resource): + """Apply Update request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param status: The status. Possible values include: 'Pending', + 'InProgress', 'Completed', 'RetryNow', 'RetryLater' + :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus + :param resource_id: The resourceId + :type resource_id: str + :param last_update_time: Last Update time + :type last_update_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ApplyUpdate, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.resource_id = kwargs.get('resource_id', None) + self.last_update_time = kwargs.get('last_update_time', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConfigurationAssignment(Resource): + """Configuration Assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Location of the resource + :type location: str + :param maintenance_configuration_id: The maintenance configuration Id + :type maintenance_configuration_id: str + :param resource_id: The unique resourceId + :type resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConfigurationAssignment, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.maintenance_configuration_id = kwargs.get('maintenance_configuration_id', None) + self.resource_id = kwargs.get('resource_id', None) + + +class ErrorDetails(Model): + """An error response details received from the Azure Maintenance service. + + :param code: Service-defined error code. This code serves as a sub-status + for the HTTP error code specified in the response. + :type code: str + :param message: Human-readable representation of the error. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class MaintenanceConfiguration(Resource): + """Maintenance configuration record type. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Gets or sets location of the resource + :type location: str + :param tags: Gets or sets tags of the resource + :type tags: dict[str, str] + :param namespace: Gets or sets namespace of the resource + :type namespace: str + :param extension_properties: Gets or sets extensionProperties of the + maintenanceConfiguration + :type extension_properties: dict[str, str] + :param maintenance_scope: Gets or sets maintenanceScope of the + configuration. Possible values include: 'All', 'Host', 'Resource', + 'InResource' + :type maintenance_scope: str or + ~azure.mgmt.maintenance.models.MaintenanceScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + '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'}, + } + + def __init__(self, **kwargs): + super(MaintenanceConfiguration, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.namespace = kwargs.get('namespace', None) + self.extension_properties = kwargs.get('extension_properties', None) + self.maintenance_scope = kwargs.get('maintenance_scope', None) + + +class MaintenanceError(Model): + """An error response received from the Azure Maintenance service. + + :param error: Details of the error + :type error: ~azure.mgmt.maintenance.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__(self, **kwargs): + super(MaintenanceError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class MaintenanceErrorException(HttpOperationError): + """Server responsed with exception of type: 'MaintenanceError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(MaintenanceErrorException, self).__init__(deserialize, response, 'MaintenanceError', *args) + + +class Operation(Model): + """Represents an operation returned by the GetOperations request. + + :param name: Name of the operation + :type name: str + :param display: Display name of the operation + :type display: ~azure.mgmt.maintenance.models.OperationInfo + :param origin: Origin of the operation + :type origin: str + :param properties: Properties of the operation + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationInfo'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationInfo(Model): + """Information about an operation. + + :param provider: Name of the provider + :type provider: str + :param resource: Name of the resource type + :type resource: str + :param operation: Name of the operation + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationInfo, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class Update(Model): + """Maintenance update on a resource. + + :param maintenance_scope: The impact area. Possible values include: 'All', + 'Host', 'Resource', 'InResource' + :type maintenance_scope: str or + ~azure.mgmt.maintenance.models.MaintenanceScope + :param impact_type: The impact type. Possible values include: 'None', + 'Freeze', 'Restart', 'Redeploy' + :type impact_type: str or ~azure.mgmt.maintenance.models.ImpactType + :param status: The status. Possible values include: 'Pending', + 'InProgress', 'Completed', 'RetryNow', 'RetryLater' + :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus + :param impact_duration_in_sec: Duration of impact in seconds + :type impact_duration_in_sec: int + :param not_before: Time when Azure will start force updates if not + self-updated by customer before this time + :type not_before: datetime + :param resource_id: The resourceId + :type resource_id: str + """ + + _attribute_map = { + 'maintenance_scope': {'key': 'maintenanceScope', 'type': 'str'}, + 'impact_type': {'key': 'impactType', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'impact_duration_in_sec': {'key': 'impactDurationInSec', 'type': 'int'}, + 'not_before': {'key': 'notBefore', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Update, self).__init__(**kwargs) + self.maintenance_scope = kwargs.get('maintenance_scope', None) + self.impact_type = kwargs.get('impact_type', None) + self.status = kwargs.get('status', None) + self.impact_duration_in_sec = kwargs.get('impact_duration_in_sec', None) + self.not_before = kwargs.get('not_before', None) + self.resource_id = kwargs.get('resource_id', None) diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models_py3.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models_py3.py new file mode 100644 index 000000000000..a87624b67e6f --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_models_py3.py @@ -0,0 +1,339 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Definition of a Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ApplyUpdate(Resource): + """Apply Update request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param status: The status. Possible values include: 'Pending', + 'InProgress', 'Completed', 'RetryNow', 'RetryLater' + :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus + :param resource_id: The resourceId + :type resource_id: str + :param last_update_time: Last Update time + :type last_update_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, status=None, resource_id: str=None, last_update_time=None, **kwargs) -> None: + super(ApplyUpdate, self).__init__(**kwargs) + self.status = status + self.resource_id = resource_id + self.last_update_time = last_update_time + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConfigurationAssignment(Resource): + """Configuration Assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Location of the resource + :type location: str + :param maintenance_configuration_id: The maintenance configuration Id + :type maintenance_configuration_id: str + :param resource_id: The unique resourceId + :type resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, maintenance_configuration_id: str=None, resource_id: str=None, **kwargs) -> None: + super(ConfigurationAssignment, self).__init__(**kwargs) + self.location = location + self.maintenance_configuration_id = maintenance_configuration_id + self.resource_id = resource_id + + +class ErrorDetails(Model): + """An error response details received from the Azure Maintenance service. + + :param code: Service-defined error code. This code serves as a sub-status + for the HTTP error code specified in the response. + :type code: str + :param message: Human-readable representation of the error. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorDetails, self).__init__(**kwargs) + self.code = code + self.message = message + + +class MaintenanceConfiguration(Resource): + """Maintenance configuration record type. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Gets or sets location of the resource + :type location: str + :param tags: Gets or sets tags of the resource + :type tags: dict[str, str] + :param namespace: Gets or sets namespace of the resource + :type namespace: str + :param extension_properties: Gets or sets extensionProperties of the + maintenanceConfiguration + :type extension_properties: dict[str, str] + :param maintenance_scope: Gets or sets maintenanceScope of the + configuration. Possible values include: 'All', 'Host', 'Resource', + 'InResource' + :type maintenance_scope: str or + ~azure.mgmt.maintenance.models.MaintenanceScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + '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'}, + } + + def __init__(self, *, location: str=None, tags=None, namespace: str=None, extension_properties=None, maintenance_scope=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 + + +class MaintenanceError(Model): + """An error response received from the Azure Maintenance service. + + :param error: Details of the error + :type error: ~azure.mgmt.maintenance.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(MaintenanceError, self).__init__(**kwargs) + self.error = error + + +class MaintenanceErrorException(HttpOperationError): + """Server responsed with exception of type: 'MaintenanceError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(MaintenanceErrorException, self).__init__(deserialize, response, 'MaintenanceError', *args) + + +class Operation(Model): + """Represents an operation returned by the GetOperations request. + + :param name: Name of the operation + :type name: str + :param display: Display name of the operation + :type display: ~azure.mgmt.maintenance.models.OperationInfo + :param origin: Origin of the operation + :type origin: str + :param properties: Properties of the operation + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationInfo'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties + + +class OperationInfo(Model): + """Information about an operation. + + :param provider: Name of the provider + :type provider: str + :param resource: Name of the resource type + :type resource: str + :param operation: Name of the operation + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationInfo, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class Update(Model): + """Maintenance update on a resource. + + :param maintenance_scope: The impact area. Possible values include: 'All', + 'Host', 'Resource', 'InResource' + :type maintenance_scope: str or + ~azure.mgmt.maintenance.models.MaintenanceScope + :param impact_type: The impact type. Possible values include: 'None', + 'Freeze', 'Restart', 'Redeploy' + :type impact_type: str or ~azure.mgmt.maintenance.models.ImpactType + :param status: The status. Possible values include: 'Pending', + 'InProgress', 'Completed', 'RetryNow', 'RetryLater' + :type status: str or ~azure.mgmt.maintenance.models.UpdateStatus + :param impact_duration_in_sec: Duration of impact in seconds + :type impact_duration_in_sec: int + :param not_before: Time when Azure will start force updates if not + self-updated by customer before this time + :type not_before: datetime + :param resource_id: The resourceId + :type resource_id: str + """ + + _attribute_map = { + 'maintenance_scope': {'key': 'maintenanceScope', 'type': 'str'}, + 'impact_type': {'key': 'impactType', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'impact_duration_in_sec': {'key': 'impactDurationInSec', 'type': 'int'}, + 'not_before': {'key': 'notBefore', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, *, maintenance_scope=None, impact_type=None, status=None, impact_duration_in_sec: int=None, not_before=None, resource_id: str=None, **kwargs) -> None: + super(Update, self).__init__(**kwargs) + self.maintenance_scope = maintenance_scope + self.impact_type = impact_type + self.status = status + self.impact_duration_in_sec = impact_duration_in_sec + self.not_before = not_before + self.resource_id = resource_id diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_paged_models.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_paged_models.py new file mode 100644 index 000000000000..45d6a08e3c6d --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/models/_paged_models.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +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 MaintenanceConfigurationPaged(Paged): + """ + 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': '[MaintenanceConfiguration]'} + } + + def __init__(self, *args, **kwargs): + + super(MaintenanceConfigurationPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class UpdatePaged(Paged): + """ + A paging container for iterating over a list of :class:`Update ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Update]'} + } + + def __init__(self, *args, **kwargs): + + super(UpdatePaged, self).__init__(*args, **kwargs) diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/__init__.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/__init__.py new file mode 100644 index 000000000000..85b97ca76a15 --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/__init__.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._apply_updates_operations import ApplyUpdatesOperations +from ._configuration_assignments_operations import ConfigurationAssignmentsOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._operations import Operations +from ._updates_operations import UpdatesOperations + +__all__ = [ + 'ApplyUpdatesOperations', + 'ConfigurationAssignmentsOperations', + 'MaintenanceConfigurationsOperations', + 'Operations', + 'UpdatesOperations', +] diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_apply_updates_operations.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_apply_updates_operations.py new file mode 100644 index 000000000000..272cc2b447f8 --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_apply_updates_operations.py @@ -0,0 +1,334 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ApplyUpdatesOperations(object): + """ApplyUpdatesOperations 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: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get_parent( + self, resource_group_name, resource_parent_type, resource_parent_name, provider_name, resource_type, resource_name, apply_update_name, custom_headers=None, raw=False, **operation_config): + """Track Updates to resource with parent. + + Track maintenance updates to resource with parent. + + :param resource_group_name: Resource group name + :type resource_group_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 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 apply_update_name: applyUpdate Id + :type apply_update_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: ApplyUpdate or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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'), + 'resourceParentType': self._serialize.url("resource_parent_type", resource_parent_type, 'str'), + 'resourceParentName': self._serialize.url("resource_parent_name", resource_parent_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'), + 'applyUpdateName': self._serialize.url("apply_update_name", apply_update_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApplyUpdate', 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/applyUpdates/{applyUpdateName}'} + + def get( + self, resource_group_name, provider_name, resource_type, resource_name, apply_update_name, custom_headers=None, raw=False, **operation_config): + """Track Updates to resource. + + Track maintenance updates to 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 apply_update_name: applyUpdate Id + :type apply_update_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: ApplyUpdate or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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'), + 'applyUpdateName': self._serialize.url("apply_update_name", apply_update_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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApplyUpdate', 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/applyUpdates/{applyUpdateName}'} + + def create_or_update_parent( + self, resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Apply Updates to resource with parent. + + Apply maintenance updates to resource with parent. + + :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 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: ApplyUpdate or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update_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') + } + 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.put(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 + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApplyUpdate', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default'} + + def create_or_update( + self, resource_group_name, provider_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Apply Updates to resource. + + Apply maintenance updates to 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 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: ApplyUpdate or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.maintenance.models.ApplyUpdate or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.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') + } + 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.put(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 + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApplyUpdate', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default'} diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_configuration_assignments_operations.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_configuration_assignments_operations.py new file mode 100644 index 000000000000..489a8991644a --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_configuration_assignments_operations.py @@ -0,0 +1,522 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ConfigurationAssignmentsOperations(object): + """ConfigurationAssignmentsOperations 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: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + 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. + + Register 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 configuration_assignment: The configurationAssignment + :type configuration_assignment: + ~azure.mgmt.maintenance.models.ConfigurationAssignment + :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:`CloudError` + """ + # Construct URL + url = self.create_or_update_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' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(configuration_assignment, 'ConfigurationAssignment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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 + + 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 + create_or_update_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + + def delete_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): + """Unregister configuration for resource. + + Unregister 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: Unique 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:`CloudError` + """ + # Construct URL + url = self.delete_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.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 + + 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 + delete_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{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. + + Register 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 configuration_assignment: The configurationAssignment + :type configuration_assignment: + ~azure.mgmt.maintenance.models.ConfigurationAssignment + :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:`CloudError` + """ + # Construct URL + url = self.create_or_update.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' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(configuration_assignment, 'ConfigurationAssignment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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 + + 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 + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + + def delete( + self, resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers=None, raw=False, **operation_config): + """Unregister configuration for resource. + + Unregister 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: Unique 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:`CloudError` + """ + # Construct URL + url = self.delete.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.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 + + 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 + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'} + + def list_parent( + self, resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """List configurationAssignments for resource. + + List configurationAssignments 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 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:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_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') + } + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConfigurationAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments'} + + def list( + self, resource_group_name, provider_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """List configurationAssignments for resource. + + List configurationAssignments 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 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:`CloudError` + """ + 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'), + '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') + } + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + 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}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments'} diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_maintenance_configurations_operations.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..29b3618e634a --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_maintenance_configurations_operations.py @@ -0,0 +1,358 @@ +# 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 MaintenanceConfigurationsOperations(object): + """MaintenanceConfigurationsOperations 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: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get Configuration record. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}'} + + def create_or_update( + self, resource_group_name, resource_name, configuration, custom_headers=None, raw=False, **operation_config): + """Create or Update configuration record. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :param resource_name: Resource Identifier + :type resource_name: str + :param configuration: The configuration + :type configuration: + ~azure.mgmt.maintenance.models.MaintenanceConfiguration + :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.create_or_update.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'), + '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' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(configuration, 'MaintenanceConfiguration') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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 + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}'} + + def delete( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Delete Configuration record. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :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.delete.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'), + '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.delete(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 + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}'} + + def update_method( + self, resource_group_name, resource_name, configuration, custom_headers=None, raw=False, **operation_config): + """Patch configuration record. + + :param resource_group_name: Resource Group Name + :type resource_group_name: str + :param resource_name: Resource Identifier + :type resource_name: str + :param configuration: The configuration + :type configuration: + ~azure.mgmt.maintenance.models.MaintenanceConfiguration + :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.update_method.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'), + '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' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(configuration, 'MaintenanceConfiguration') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + 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 + update_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}'} + + 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 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/maintenanceConfigurations'} diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_operations.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_operations.py new file mode 100644 index 000000000000..84c26550f29a --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_operations.py @@ -0,0 +1,103 @@ +# 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 Operations(object): + """Operations 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: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """List available operations. + + List the available operations supported by the Microsoft.Maintenance + resource provider. + + :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 Operation + :rtype: + ~azure.mgmt.maintenance.models.OperationPaged[~azure.mgmt.maintenance.models.Operation] + :raises: + :class:`MaintenanceErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # 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.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Maintenance/operations'} diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_updates_operations.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_updates_operations.py new file mode 100644 index 000000000000..e9a8eecb77c2 --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/operations/_updates_operations.py @@ -0,0 +1,206 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class UpdatesOperations(object): + """UpdatesOperations 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: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def list_parent( + self, resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Get Updates to resource. + + Get updates to resources. + + :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 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 Update + :rtype: + ~azure.mgmt.maintenance.models.UpdatePaged[~azure.mgmt.maintenance.models.Update] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_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') + } + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UpdatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_parent.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates'} + + def list( + self, resource_group_name, provider_name, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Get Updates to resource. + + Get updates to resources. + + :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 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 Update + :rtype: + ~azure.mgmt.maintenance.models.UpdatePaged[~azure.mgmt.maintenance.models.Update] + :raises: :class:`CloudError` + """ + 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'), + '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') + } + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.UpdatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates'} diff --git a/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/version.py b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/version.py new file mode 100644 index 000000000000..a39916c162ce --- /dev/null +++ b/sdk/azure-mgmt-Maintenance/azure/mgmt/Maintenance/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0" +