diff --git a/azure-mgmt-workloadmonitor/MANIFEST.in b/azure-mgmt-workloadmonitor/MANIFEST.in index bb37a2723dae..6ceb27f7a96e 100644 --- a/azure-mgmt-workloadmonitor/MANIFEST.in +++ b/azure-mgmt-workloadmonitor/MANIFEST.in @@ -1 +1,4 @@ include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting.py b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting.py index 6ca8525806e2..22cd1ae5d8bd 100644 --- a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting.py +++ b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting.py @@ -13,7 +13,7 @@ class NotificationSetting(ProxyResource): - """Model for component. + """Model for NotificationSetting. Variables are only populated by the server, and will be ignored when sending a request. @@ -28,8 +28,9 @@ class NotificationSetting(ProxyResource): :vartype type: str :ivar etag: For optimistic concurrency control. :vartype etag: str - :ivar action_groups: List of action group resource ids to be notified - :vartype action_groups: list[str] + :ivar action_group_resource_ids: List of action group resource ids to be + notified + :vartype action_group_resource_ids: list[str] """ _validation = { @@ -37,7 +38,7 @@ class NotificationSetting(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'action_groups': {'readonly': True}, + 'action_group_resource_ids': {'readonly': True}, } _attribute_map = { @@ -45,10 +46,10 @@ class NotificationSetting(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, - 'action_groups': {'key': 'properties.actionGroups', 'type': '[str]'}, + 'action_group_resource_ids': {'key': 'properties.actionGroupResourceIds', 'type': '[str]'}, } def __init__(self, **kwargs): super(NotificationSetting, self).__init__(**kwargs) self.etag = None - self.action_groups = None + self.action_group_resource_ids = None diff --git a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting_py3.py b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting_py3.py index 4d77a3bcf948..7401a2f5799c 100644 --- a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting_py3.py +++ b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/notification_setting_py3.py @@ -13,7 +13,7 @@ class NotificationSetting(ProxyResource): - """Model for component. + """Model for NotificationSetting. Variables are only populated by the server, and will be ignored when sending a request. @@ -28,8 +28,9 @@ class NotificationSetting(ProxyResource): :vartype type: str :ivar etag: For optimistic concurrency control. :vartype etag: str - :ivar action_groups: List of action group resource ids to be notified - :vartype action_groups: list[str] + :ivar action_group_resource_ids: List of action group resource ids to be + notified + :vartype action_group_resource_ids: list[str] """ _validation = { @@ -37,7 +38,7 @@ class NotificationSetting(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'action_groups': {'readonly': True}, + 'action_group_resource_ids': {'readonly': True}, } _attribute_map = { @@ -45,10 +46,10 @@ class NotificationSetting(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, - 'action_groups': {'key': 'properties.actionGroups', 'type': '[str]'}, + 'action_group_resource_ids': {'key': 'properties.actionGroupResourceIds', 'type': '[str]'}, } def __init__(self, **kwargs) -> None: super(NotificationSetting, self).__init__(**kwargs) self.etag = None - self.action_groups = None + self.action_group_resource_ids = None diff --git a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/notification_settings_operations.py b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/notification_settings_operations.py index 9f87e33d0e13..27af9b065e5b 100644 --- a/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/notification_settings_operations.py +++ b/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/notification_settings_operations.py @@ -23,6 +23,7 @@ class NotificationSettingsOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar api_version: The API version to use for this operation. Constant value: "2018-08-31-preview". + :ivar notification_setting_name: Default string modeled as parameter for URL to work correctly. Constant value: "default". """ models = models @@ -33,6 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.api_version = "2018-08-31-preview" + self.notification_setting_name = "default" self.config = config @@ -116,3 +118,147 @@ def internal_paging(next_link=None, raw=False): return deserialized list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings'} + + def get( + self, resource_group_name, resource_namespace, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Get a of notification setting for a resource. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param resource_namespace: The Namespace of the resource. + :type resource_namespace: str + :param resource_type: The type of the resource. + :type resource_type: str + :param resource_name: Name of the resource. + :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: NotificationSetting or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.workloadmonitor.models.NotificationSetting or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'notificationSettingName': self._serialize.url("self.notification_setting_name", self.notification_setting_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.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NotificationSetting', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}'} + + def update( + self, resource_group_name, resource_namespace, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Update notification settings for a resource. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param resource_namespace: The Namespace of the resource. + :type resource_namespace: str + :param resource_type: The type of the resource. + :type resource_type: str + :param resource_name: Name of the resource. + :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: NotificationSetting or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.workloadmonitor.models.NotificationSetting or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + body = None + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'notificationSettingName': self._serialize.url("self.notification_setting_name", self.notification_setting_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(body, 'NotificationSetting') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NotificationSetting', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}'}