about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_notification/notification.py
blob: 913808701dcef90db9d6cf2c1d41818d93e8d65c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

from typing import List, Optional

from azure.ai.ml._restclient.v2023_02_01_preview.models import NotificationSetting as RestNotificationSetting
from azure.ai.ml.entities._mixins import RestTranslatableMixin


class Notification(RestTranslatableMixin):
    """Configuration for notification.

    :param email_on: Send email notification to user on specified notification type. Accepted values are
        "JobCompleted", "JobFailed", and "JobCancelled".
    :type email_on: Optional[list[str]]
    :param: The email recipient list which. Note that this parameter has a character limit of 499 which
        includes all of the recipient strings and each comma seperator.
    :paramtype emails: Optional[list[str]]
    """

    def __init__(self, *, email_on: Optional[List[str]] = None, emails: Optional[List[str]] = None) -> None:
        self.email_on = email_on
        self.emails = emails

    def _to_rest_object(self) -> RestNotificationSetting:
        return RestNotificationSetting(email_on=self.email_on, emails=self.emails)

    @classmethod
    def _from_rest_object(cls, obj: RestNotificationSetting) -> Optional["Notification"]:
        if not obj:
            return None
        return Notification(email_on=obj.email_on, emails=obj.emails)